Handle application/testing region string inconsistency.

This commit is contained in:
Mark Feit
2018-02-10 10:16:04 -05:00
parent cc6e96527e
commit 9d632c0434

View File

@@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"net/http"
"strings"
"time"
)
@@ -45,6 +46,15 @@ func CreateWasabiStorage(
threads int,
) (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,
storageDir, accessKey, secretKey, threads,
true, // isSSLSupported
@@ -100,9 +110,6 @@ func (storage *WasabiStorage) MoveFile(
// The from path includes the bucket
from_path := fmt.Sprintf("/%s/%s/%s", storage.bucket, storage.storageDir, from)
// The to path does not.
// to_path := fmt.Sprintf("%s/%s", storage.storageDir, from)
// We get the region with an @ on the end, so don't add another.
object := fmt.Sprintf("https://%s%s%s",
storage.region, storage.endpoint, from_path)