Handle a couple errors around link files
This commit is contained in:
parent
1be35b21b6
commit
567907c2d4
@ -50,6 +50,9 @@ func LocalMediaPath(sha string) (string, error) {
|
||||
}
|
||||
|
||||
func LocalLinkPath(sha string) (string, error) {
|
||||
if len(sha) == 0 {
|
||||
return "", fmt.Errorf("Error trying to create local object directory, invalid sha: '%s'", sha)
|
||||
}
|
||||
path := filepath.Join(LocalLinkDir, sha[0:2])
|
||||
if err := os.MkdirAll(path, 0744); err != nil {
|
||||
return "", fmt.Errorf("Error trying to create local object directory in '%s': %s", path, err)
|
||||
|
@ -64,7 +64,11 @@ func (p *Pointer) CreateLink(filename string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
gitHash.Write([]byte(p.Encoded()))
|
||||
_, err = gitHash.Write([]byte(p.Encoded()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
gitHash.Close()
|
||||
hash := gitHash.Hash()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user