mirror of
https://github.com/rclone/rclone.git
synced 2025-08-23 19:36:08 +02:00
cache: preserve leading / in wrapped remote path
When combining the remote value and the root path, preserve the absence or presence of the / at the beginning of the wrapped remote path. e.g. a remote "cloud:" and root path "dir" becomes "cloud:dir" instead of "cloud:/dir". Fixes #2553
This commit is contained in:
committed by
Nick Craig-Wood
parent
eb5a95e7de
commit
f6ee0795ac
11
backend/cache/cache.go
vendored
11
backend/cache/cache.go
vendored
@@ -263,10 +263,15 @@ func NewFs(name, rootPath string, m configmap.Mapper) (fs.Fs, error) {
|
||||
return nil, errors.Wrapf(err, "failed to clean root path %q", rootPath)
|
||||
}
|
||||
|
||||
remotePath := path.Join(opt.Remote, rpath)
|
||||
wrappedFs, wrapErr := fs.NewFs(remotePath)
|
||||
wInfo, wName, wPath, wConfig, err := fs.ConfigFs(opt.Remote)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to parse remote %q to wrap", opt.Remote)
|
||||
}
|
||||
|
||||
remotePath := path.Join(wPath, rootPath)
|
||||
wrappedFs, wrapErr := wInfo.NewFs(wName, remotePath, wConfig)
|
||||
if wrapErr != nil && wrapErr != fs.ErrorIsFile {
|
||||
return nil, errors.Wrapf(wrapErr, "failed to make remote %q to wrap", remotePath)
|
||||
return nil, errors.Wrapf(wrapErr, "failed to make remote %s:%s to wrap", wName, remotePath)
|
||||
}
|
||||
var fsErr error
|
||||
fs.Debugf(name, "wrapped %v:%v at root %v", wrappedFs.Name(), wrappedFs.Root(), rpath)
|
||||
|
Reference in New Issue
Block a user