Skip to content

Commit b5e72e2

Browse files
committed
vfs: fix the cache failing to upload symlinks when --links was specified
Before this change, if --vfs-cache-mode writes or above was set and --links was in use, when a symlink was saved then the VFS failed to upload it. This meant when the VFS was restarted the link wasn't there any more. This was caused by the local backend, which we use to manage the VFS cache, picking up the global --links flag. This patch makes sure that the internal instantations of the local backend in the VFS cache don't ever use the --links flag or the --local-links flag even if specified on the command line. Fixes rclone#8367
1 parent 8997993 commit b5e72e2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vfs/vfscache/cache.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ func (c *Cache) createItemDir(name string) (string, error) {
227227

228228
// getBackend gets a backend for a cache root dir
229229
func getBackend(ctx context.Context, parentPath string, name string, relativeDirPath string) (fs.Fs, error) {
230-
path := fmt.Sprintf(":local,encoding='%v':%s/%s/%s", encoder.OS, parentPath, name, relativeDirPath)
230+
// Make sure we turn off the global links flag as it overrides the backend specific one
231+
ctx, ci := fs.AddConfig(ctx)
232+
ci.Links = false
233+
path := fmt.Sprintf(":local,encoding='%v',links=false:%s/%s/%s", encoder.OS, parentPath, name, relativeDirPath)
231234
return fscache.Get(ctx, path)
232235
}
233236

0 commit comments

Comments
 (0)