From 191cfb79d131c39e0d4825a0beb0382b0c4c678c Mon Sep 17 00:00:00 2001 From: Xiaoxing Ye Date: Sun, 27 Oct 2019 01:02:22 +0800 Subject: [PATCH] onedrive: no trailing slash reading metadata... No trailing slash when reading metadata of an item given item ID. This should fix #3664. --- backend/onedrive/onedrive.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index f9b8e6d4c..b64d68263 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -351,8 +351,13 @@ func shouldRetry(resp *http.Response, err error) (bool, error) { // instead of simply using `drives/driveID/root:/itemPath` because it works for // "shared with me" folders in OneDrive Personal (See #2536, #2778) // This path pattern comes from https://github.com/OneDrive/onedrive-api-docs/issues/908#issuecomment-417488480 +// +// If `relPath` == '', do not append the slash (See #3664) func (f *Fs) readMetaDataForPathRelativeToID(ctx context.Context, normalizedID string, relPath string) (info *api.Item, resp *http.Response, err error) { - opts := newOptsCall(normalizedID, "GET", ":/"+withTrailingColon(rest.URLPathEscape(enc.FromStandardPath(relPath)))) + if relPath != "" { + relPath = "/" + withTrailingColon(rest.URLPathEscape(enc.FromStandardPath(relPath))) + } + opts := newOptsCall(normalizedID, "GET", ":"+relPath) err = f.pacer.Call(func() (bool, error) { resp, err = f.srv.CallJSON(ctx, &opts, nil, &info) return shouldRetry(resp, err)