Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

putio: fix parsing of remotes with leading and trailing /

Nick Craig-Wood8c9c86c3d613
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 {