From dcce84714e9d8aea3993f453aeadbbdc5ce37fe8 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 14 Oct 2018 14:17:53 +0100 Subject: [PATCH] onedrive: fix link command for non root --- backend/onedrive/onedrive.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index 90ab96e5d..8b97b183b 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -1113,7 +1113,7 @@ func (f *Fs) Hashes() hash.Set { // PublicLink returns a link for downloading without accout. func (f *Fs) PublicLink(remote string) (link string, err error) { - info, _, err := f.readMetaDataForPath(f.Root()) + info, _, err := f.readMetaDataForPath(f.srvPath(remote)) if err != nil { return "", err } @@ -1157,9 +1157,14 @@ func (o *Object) Remote() string { return o.remote } +// srvPath returns a path for use in server given a remote +func (f *Fs) srvPath(remote string) string { + return replaceReservedChars(f.rootSlash() + remote) +} + // srvPath returns a path for use in server func (o *Object) srvPath() string { - return replaceReservedChars(o.fs.rootSlash() + o.remote) + return o.fs.srvPath(o.remote) } // Hash returns the SHA-1 of an object returning a lowercase hex string