From 84f7c513d504e3e636eb2e0aa5e67ba94a817ea5 Mon Sep 17 00:00:00 2001 From: Jason Tackaberry Date: Wed, 11 Jul 2018 22:53:47 -0400 Subject: [PATCH 1/2] Fix "Failed to fossilize chunk" errors in wasabi backend Fixes #458 --- src/duplicacy_wasabistorage.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/duplicacy_wasabistorage.go b/src/duplicacy_wasabistorage.go index b4011c4..0388c4f 100644 --- a/src/duplicacy_wasabistorage.go +++ b/src/duplicacy_wasabistorage.go @@ -20,6 +20,7 @@ import ( "fmt" "net/http" "time" + "strings" ) type WasabiStorage struct { @@ -99,6 +100,8 @@ func (storage *WasabiStorage) MoveFile( // The from path includes the bucket from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from) + // Ensure no double slashes exist in the path which angers Wasabi's backend + from_path = strings.Replace(from_path, "//", "/", -1) object := fmt.Sprintf("https://%s@%s%s", storage.region, storage.endpoint, from_path) From 117cfd997fc472085f6b927e551a7d5073d1ed11 Mon Sep 17 00:00:00 2001 From: Jason Tackaberry Date: Fri, 13 Jul 2018 12:43:27 -0400 Subject: [PATCH 2/2] Make Wasabi double slash fix more idiomatic --- src/duplicacy_wasabistorage.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/duplicacy_wasabistorage.go b/src/duplicacy_wasabistorage.go index 0388c4f..9cf59a2 100644 --- a/src/duplicacy_wasabistorage.go +++ b/src/duplicacy_wasabistorage.go @@ -20,7 +20,6 @@ import ( "fmt" "net/http" "time" - "strings" ) type WasabiStorage struct { @@ -98,10 +97,14 @@ func (storage *WasabiStorage) MoveFile( threadIndex int, from string, to string, ) (err error) { - // The from path includes the bucket - from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from) - // Ensure no double slashes exist in the path which angers Wasabi's backend - from_path = strings.Replace(from_path, "//", "/", -1) + var from_path string + // The from path includes the bucket. Take care not to include an empty storageDir + // string as Wasabi's backend will return 404 on URLs with double slashes. + if (storage.storageDir == "") { + from_path = fmt.Sprintf("/%s/%s", storage.bucket, from) + } else { + from_path = fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from) + } object := fmt.Sprintf("https://%s@%s%s", storage.region, storage.endpoint, from_path)