mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-24 22:20:28 +01:00
Addressing comments part 1
This commit is contained in:
parent
08ae3c73c8
commit
c304b4f52b
@ -52,7 +52,7 @@ func NewStorageBackend(opts Config, logFunc storage.Log) (storage.Backend, error
|
|||||||
logFunc(storage.LogLevelInfo, "Dropbox", "Fetching fresh access token for Dropbox storage backend.")
|
logFunc(storage.LogLevelInfo, "Dropbox", "Fetching fresh access token for Dropbox storage backend.")
|
||||||
token := &oauth2.Token{RefreshToken: opts.RefreshToken}
|
token := &oauth2.Token{RefreshToken: opts.RefreshToken}
|
||||||
if !isCITest {
|
if !isCITest {
|
||||||
tkSource := conf.TokenSource(context.TODO(), &oauth2.Token{RefreshToken: opts.RefreshToken})
|
tkSource := conf.TokenSource(context.Background(), &oauth2.Token{RefreshToken: opts.RefreshToken})
|
||||||
var err error
|
var err error
|
||||||
token, err = tkSource.Token()
|
token, err = tkSource.Token()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -101,11 +101,10 @@ func (b *dropboxStorage) Copy(file string) error {
|
|||||||
if _, err := b.client.CreateFolderV2(folderArg); err != nil {
|
if _, err := b.client.CreateFolderV2(folderArg); err != nil {
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case files.CreateFolderV2APIError:
|
case files.CreateFolderV2APIError:
|
||||||
if err.EndpointError.Path.Tag == files.WriteErrorConflict {
|
if err.EndpointError.Path.Tag != files.WriteErrorConflict {
|
||||||
b.Log(storage.LogLevelInfo, b.Name(), "Destination path '%s' already exists in Dropbox, no new directory required.", b.DestinationPath)
|
|
||||||
} else {
|
|
||||||
return fmt.Errorf("(*dropboxStorage).Copy: Error creating directory '%s' in Dropbox: %w", b.DestinationPath, err)
|
return fmt.Errorf("(*dropboxStorage).Copy: Error creating directory '%s' in Dropbox: %w", b.DestinationPath, err)
|
||||||
}
|
}
|
||||||
|
b.Log(storage.LogLevelInfo, b.Name(), "Destination path '%s' already exists in Dropbox, no new directory required.", b.DestinationPath)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("(*dropboxStorage).Copy: Error creating directory '%s' in Dropbox: %w", b.DestinationPath, err)
|
return fmt.Errorf("(*dropboxStorage).Copy: Error creating directory '%s' in Dropbox: %w", b.DestinationPath, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user