mirror of
https://github.com/rclone/rclone.git
synced 2025-03-10 20:45:14 +08:00
dropbox: Retry link without expiry
Dropbox only allows public links with expiry for certain account types. Rather than erroring for other accounts, retry without expiry.
This commit is contained in:
parent
904c9b2e24
commit
4fc9583feb
@ -1333,6 +1333,16 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
|
|||||||
return shouldRetry(ctx, err)
|
return shouldRetry(ctx, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil && createArg.Settings.Expires != nil && strings.Contains(err.Error(), sharing.SharedLinkSettingsErrorNotAuthorized) {
|
||||||
|
// Some plans can't create links with expiry
|
||||||
|
fs.Debugf(absPath, "can't create link with expiry, trying without")
|
||||||
|
createArg.Settings.Expires = nil
|
||||||
|
err = f.pacer.Call(func() (bool, error) {
|
||||||
|
linkRes, err = f.sharing.CreateSharedLinkWithSettings(&createArg)
|
||||||
|
return shouldRetry(ctx, err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil && strings.Contains(err.Error(),
|
if err != nil && strings.Contains(err.Error(),
|
||||||
sharing.CreateSharedLinkWithSettingsErrorSharedLinkAlreadyExists) {
|
sharing.CreateSharedLinkWithSettingsErrorSharedLinkAlreadyExists) {
|
||||||
fs.Debugf(absPath, "has a public link already, attempting to retrieve it")
|
fs.Debugf(absPath, "has a public link already, attempting to retrieve it")
|
||||||
|
@ -144,10 +144,6 @@ backends:
|
|||||||
- backend: "dropbox"
|
- backend: "dropbox"
|
||||||
remote: "TestDropbox:"
|
remote: "TestDropbox:"
|
||||||
fastlist: false
|
fastlist: false
|
||||||
ignore:
|
|
||||||
# This test doesn't work on a standard dropbox account because it
|
|
||||||
# tries to set the expiry of the link
|
|
||||||
- TestIntegration/FsMkdir/FsPutFiles/PublicLink
|
|
||||||
# - backend: "filefabric"
|
# - backend: "filefabric"
|
||||||
# remote: "TestFileFabric:"
|
# remote: "TestFileFabric:"
|
||||||
# fastlist: false
|
# fastlist: false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user