From 8c9c86c3d613f22660246deb19e427f28e426705 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 14 May 2020 11:52:43 +0100 Subject: [PATCH] putio: fix parsing of remotes with leading and trailing / See: https://forum.rclone.org/t/unable-to-copy-from-remote-but-mount-works/16351/ --- backend/putio/fs.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/putio/fs.go b/backend/putio/fs.go index 08cad8ea3..d35414a2a 100644 --- a/backend/putio/fs.go +++ b/backend/putio/fs.go @@ -61,6 +61,12 @@ func (f *Fs) Features() *fs.Features { return f.features } +// parsePath parses a putio 'url' +func parsePath(path string) (root string) { + root = strings.Trim(path, "/") + return +} + // NewFs constructs an Fs from the path, container:path func NewFs(name, root string, m configmap.Mapper) (f fs.Fs, err error) { // defer log.Trace(name, "root=%v", root)("f=%+v, err=%v", &f, &err) @@ -70,6 +76,7 @@ func NewFs(name, root string, m configmap.Mapper) (f fs.Fs, err error) { if err != nil { return nil, err } + root = parsePath(root) httpClient := fshttp.NewClient(fs.Config) oAuthClient, _, err := oauthutil.NewClientWithBaseClient(name, m, putioConfig, httpClient) if err != nil {