From 28255f1bacb2b4c46a0fd002b7477a92e0144c5b Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 11 Jun 2020 13:06:02 +0100 Subject: [PATCH] vfs: fix errors when using > 260 char files in the cache in Windows This makes the cache use UNC paths on Windows. This stops the cache exploding when using > 260 character paths --- vfs/vfscache/cache.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.go index d1a1e1d36..3d1f18021 100644 --- a/vfs/vfscache/cache.go +++ b/vfs/vfscache/cache.go @@ -20,6 +20,7 @@ import ( "github.com/rclone/rclone/fs/hash" "github.com/rclone/rclone/fs/log" "github.com/rclone/rclone/fs/operations" + "github.com/rclone/rclone/lib/file" "github.com/rclone/rclone/vfs/vfscommon" ) @@ -60,9 +61,9 @@ func New(ctx context.Context, fremote fs.Fs, opt *vfscommon.Options) (*Cache, er } fRoot = strings.Replace(fRoot, ":", "", -1) } - root := filepath.Join(config.CacheDir, "vfs", fremote.Name(), fRoot) + root := file.UNCPath(filepath.Join(config.CacheDir, "vfs", fremote.Name(), fRoot)) fs.Debugf(nil, "vfs cache root is %q", root) - metaRoot := filepath.Join(config.CacheDir, "vfsMeta", fremote.Name(), fRoot) + metaRoot := file.UNCPath(filepath.Join(config.CacheDir, "vfsMeta", fremote.Name(), fRoot)) fs.Debugf(nil, "vfs metadata cache root is %q", root) fcache, err := fscache.Get(root)