From 957311f4792792125b2e59376edebfb55cd56e21 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 11 Apr 2020 13:47:56 +0100 Subject: [PATCH] b2: fix transfers when using download_url Before this fix, if an object had ID set and download_url was in use, downloading the object would give this error: failed to open for download: bucket example_bucket does not have file: /b2api/v1/b2_download_file_by_id (404 not_found) After this fix we only download by ID if download_url is not set See: https://forum.rclone.org/t/correct-format-for-rclone-b2-download-url-variable/15498 --- backend/b2/b2.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/b2/b2.go b/backend/b2/b2.go index 5698c672b..8b06ff8ed 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -1672,8 +1672,8 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read opts.RootURL = o.fs.opt.DownloadURL } - // Download by id if set otherwise by name - if o.id != "" { + // Download by id if set and not using DownloadURL otherwise by name + if o.id != "" && o.fs.opt.DownloadURL == "" { opts.Path += "/b2api/v1/b2_download_file_by_id?fileId=" + urlEncode(o.id) } else { bucket, bucketPath := o.split()