1
mirror of https://github.com/rclone/rclone synced 2024-12-21 11:45:56 +01:00

rc: fix operations/publiclink default for expires parameter

Before this change the expires parameter was defaulting to 0 if not
provided.

This change makes it default to fs.DurationOff which is the same as
the `rclone link` command.

See: https://forum.rclone.org/t/operations-publiclink-from-dropbox-error-not-autorized/27374
This commit is contained in:
Nick Craig-Wood 2021-11-09 10:18:49 +00:00
parent 0c03aa3a8b
commit f36d6d01b5

View File

@ -384,7 +384,9 @@ func rcPublicLink(ctx context.Context, in rc.Params) (out rc.Params, err error)
}
unlink, _ := in.GetBool("unlink")
expire, err := in.GetDuration("expire")
if err != nil && !rc.IsErrParamNotFound(err) {
if rc.IsErrParamNotFound(err) {
expire = time.Duration(fs.DurationOff)
} else if err != nil {
return nil, err
}
url, err := PublicLink(ctx, f, remote, fs.Duration(expire), unlink)