Upload the cached version of the file instead of trying to upload the

original, in case the original has since been deleted
This commit is contained in:
Aaron Lindsay 2013-08-14 07:23:32 -04:00
parent 78e45facd7
commit 0c9b4cb057

View File

@ -133,7 +133,8 @@ func ProcessLocalEvent(globals AsinkGlobals, event *asink.Event) {
}
//rename to local cache w/ filename=hash
err = os.Rename(tmpfilename, path.Join(globals.cacheDir, event.Hash))
cachedFilename := path.Join(globals.cacheDir, event.Hash)
err = os.Rename(tmpfilename, cachedFilename)
if err != nil {
err := os.Remove(tmpfilename)
if err != nil {
@ -143,7 +144,7 @@ func ProcessLocalEvent(globals AsinkGlobals, event *asink.Event) {
}
//upload file to remote storage
err = globals.storage.Put(event.Path, event.Hash)
err = globals.storage.Put(cachedFilename, event.Hash)
if err != nil {
panic(err)
}