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

union: refactor to use fspath.SplitFs instead of fs.ParseRemote #4996

Nick Craig-Woodf17d7c00126e
diff --git a/backend/union/upstream/upstream.go b/backend/union/upstream/upstream.go
index 44b3e00e4..99973f9e2 100644
--- a/backend/union/upstream/upstream.go
+++ b/backend/union/upstream/upstream.go
@@ -14,6 +14,7 @@ import (
"github.com/pkg/errors"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/cache"
+ "github.com/rclone/rclone/fs/fspath"
)
var (
@@ -62,7 +63,7 @@ type Entry interface {
// New creates a new Fs based on the
// string formatted `type:root_path(:ro/:nc)`
func New(ctx context.Context, remote, root string, cacheTime time.Duration) (*Fs, error) {
- _, configName, fsPath, err := fs.ParseRemote(remote)
+ configName, fsPath, err := fspath.SplitFs(remote)
if err != nil {
return nil, err
}
@@ -83,10 +84,8 @@ func New(ctx context.Context, remote, root string, cacheTime time.Duration) (*Fs
f.creatable = false
fsPath = fsPath[0 : len(fsPath)-3]
}
- if configName != "local" {
- fsPath = configName + ":" + fsPath
- }
- rFs, err := cache.Get(ctx, fsPath)
+ remote = configName + fsPath
+ rFs, err := cache.Get(ctx, remote)
if err != nil && err != fs.ErrorIsFile {
return nil, err
}