mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-11 05:43:23 +00:00
Make Wasabi double slash fix more idiomatic
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type WasabiStorage struct {
|
type WasabiStorage struct {
|
||||||
@@ -98,10 +97,14 @@ func (storage *WasabiStorage) MoveFile(
|
|||||||
threadIndex int, from string, to string,
|
threadIndex int, from string, to string,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
|
|
||||||
// The from path includes the bucket
|
var from_path string
|
||||||
from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from)
|
// The from path includes the bucket. Take care not to include an empty storageDir
|
||||||
// Ensure no double slashes exist in the path which angers Wasabi's backend
|
// string as Wasabi's backend will return 404 on URLs with double slashes.
|
||||||
from_path = strings.Replace(from_path, "//", "/", -1)
|
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",
|
object := fmt.Sprintf("https://%s@%s%s",
|
||||||
storage.region, storage.endpoint, from_path)
|
storage.region, storage.endpoint, from_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user