Correct handling of @ in region to be consistent with everythng else.

This commit is contained in:
Mark Feit
2018-02-11 07:51:34 -05:00
parent 9d632c0434
commit 8fdb399e1b
2 changed files with 5 additions and 12 deletions

View File

@@ -468,6 +468,10 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor
endpoint := matched[3] endpoint := matched[3]
bucket := matched[5] bucket := matched[5]
if region != "" {
region = region[:len(region)-1]
}
key := GetPassword(preference, "wasabi_key", key := GetPassword(preference, "wasabi_key",
"Enter Wasabi key:", true, resetPassword) "Enter Wasabi key:", true, resetPassword)
secret := GetPassword(preference, "wasabi_secret", secret := GetPassword(preference, "wasabi_secret",

View File

@@ -19,7 +19,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"strings"
"time" "time"
) )
@@ -46,15 +45,6 @@ func CreateWasabiStorage(
threads int, threads int,
) (storage *WasabiStorage, err error) { ) (storage *WasabiStorage, err error) {
// The application code that parses the URL from the
// configuration leaves an @ on the end, while the code that
// does the testing doesn't. Force the incoming value to
// behave like the application.
if regionName != "" && !strings.HasSuffix(regionName, "@") {
regionName = regionName + "@"
}
s3storage, error := CreateS3Storage(regionName, endpoint, bucketName, s3storage, error := CreateS3Storage(regionName, endpoint, bucketName,
storageDir, accessKey, secretKey, threads, storageDir, accessKey, secretKey, threads,
true, // isSSLSupported true, // isSSLSupported
@@ -110,8 +100,7 @@ func (storage *WasabiStorage) MoveFile(
// The from path includes the bucket // The from path includes the bucket
from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from) from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from)
// We get the region with an @ on the end, so don't add another. 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)
// The object's new name is relative to the top of the bucket. // The object's new name is relative to the top of the bucket.