"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
oauthutil: copy the config before modifying it
Nick Craig-Wood166fd5045170
diff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.goindex 3e2cec490..989800086 100644--- a/oauthutil/oauthutil.go+++ b/oauthutil/oauthutil.go@@ -194,8 +194,11 @@ func Context() context.Context {// overrideCredentials sets the ClientID and ClientSecret from the// config file if they are not blank.// If any value is overridden, true is returned.-func overrideCredentials(name string, config *oauth2.Config) bool {- changed := false+// the origConfig is copied+func overrideCredentials(name string, origConfig *oauth2.Config) (config *oauth2.Config, changed bool) {+ config = new(oauth2.Config)+ *config = *origConfig+ changed = falseClientID := fs.ConfigFileGet(name, fs.ConfigClientID)if ClientID != "" {config.ClientID = ClientID@@ -206,13 +209,13 @@ func overrideCredentials(name string, config *oauth2.Config) bool {config.ClientSecret = ClientSecretchanged = true}- return changed+ return config, changed}// NewClient gets a token from the config file and configures a Client// with it. It returns the client and a TokenSource which Invalidate may need to be called onfunc NewClient(name string, config *oauth2.Config) (*http.Client, *TokenSource, error) {- overrideCredentials(name, config)+ config, _ = overrideCredentials(name, config)token, err := getToken(name)if err != nil {return nil, nil, err@@ -237,7 +240,7 @@ func NewClient(name string, config *oauth2.Config) (*http.Client, *TokenSource,//// It may run an internal webserver to receive the resultsfunc Config(id, name string, config *oauth2.Config) error {- changed := overrideCredentials(name, config)+ config, changed := overrideCredentials(name, config)automatic := fs.ConfigFileGet(name, fs.ConfigAutomatic) != ""// See if already have a token