"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
vfs: fix invalid cache path on windows when using :backend: as remote
albertony459cc70a50a6
diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.goindex bd7be51a3..2d1950ab0 100644--- a/vfs/vfscache/cache.go+++ b/vfs/vfscache/cache.go@@ -74,21 +74,26 @@ type AddVirtualFn func(remote string, size int64, isDir bool) error// This starts background goroutines which can be cancelled with the// context passed in.func New(ctx context.Context, fremote fs.Fs, opt *vfscommon.Options, avFn AddVirtualFn) (*Cache, error) {+ fName := fremote.Name()fRoot := filepath.FromSlash(fremote.Root())if runtime.GOOS == "windows" {if strings.HasPrefix(fRoot, `\\?`) {fRoot = fRoot[3:]}fRoot = strings.Replace(fRoot, ":", "", -1)+ // Replace leading ':' if remote was created on the fly as ":backend:/path" as it is illegal in Windows+ if fName[0] == ':' {+ fName = "^" + fName[1:]+ }}cacheDir := config.CacheDircacheDir, err := filepath.Abs(cacheDir)if err != nil {return nil, errors.Wrap(err, "failed to make --cache-dir absolute")}- root := file.UNCPath(filepath.Join(cacheDir, "vfs", fremote.Name(), fRoot))+ root := file.UNCPath(filepath.Join(cacheDir, "vfs", fName, fRoot))fs.Debugf(nil, "vfs cache: root is %q", root)- metaRoot := file.UNCPath(filepath.Join(cacheDir, "vfsMeta", fremote.Name(), fRoot))+ metaRoot := file.UNCPath(filepath.Join(cacheDir, "vfsMeta", fName, fRoot))fs.Debugf(nil, "vfs cache: metadata root is %q", root)fcache, err := fscache.Get(ctx, root)