From 842ed7d2a9a469a452c64a54f62dcfe0358daec7 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 21 Aug 2018 16:12:42 +0100 Subject: [PATCH] swift: make it so just storage_url or auth_token can be overidden Before this change if only one of storage_url or auth_token were supplied then rclone would overwrite both of them when authenticating. This effectively meant you could supply both of them or none of them only. Now rclone still does the authentication to read the missing storage_url or auth_token then afterwards re-writes the auth_token or storage_url back to what the user desired. Fixes #2464 --- backend/swift/swift.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/swift/swift.go b/backend/swift/swift.go index 681dc8858..65856a327 100644 --- a/backend/swift/swift.go +++ b/backend/swift/swift.go @@ -277,6 +277,15 @@ func swiftConnection(opt *Options, name string) (*swift.Connection, error) { // provided by wrapping the existing auth, so we can just // override one or the other or both. if StorageUrl != "" || AuthToken != "" { + // Re-write StorageURL and AuthToken if they are being + // overridden as c.Authenticate above will have + // overwritten them. + if StorageUrl != "" { + c.StorageUrl = StorageUrl + } + if AuthToken != "" { + c.AuthToken = AuthToken + } c.Auth = newAuth(c.Auth, StorageUrl, AuthToken) } return c, nil