Skip to content

Commit

Permalink
vfs: fix errors when using > 260 char files in the cache in Windows
Browse files Browse the repository at this point in the history
This makes the cache use UNC paths on Windows. This stops the cache
exploding when using > 260 character paths
  • Loading branch information
ncw committed Jun 30, 2020
1 parent 917cb4a commit 28255f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vfs/vfscache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 28255f1

Please sign in to comment.