From 0c9b4cb0573b8f96df4306894cff26d181c15607 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Wed, 14 Aug 2013 07:23:32 -0400 Subject: [PATCH] Upload the cached version of the file instead of trying to upload the original, in case the original has since been deleted --- client/asink.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/asink.go b/client/asink.go index 78de1cf..55ac099 100644 --- a/client/asink.go +++ b/client/asink.go @@ -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) }