From 4b99e84242f990281c4aca5b68aaec32dc9cf11c Mon Sep 17 00:00:00 2001 From: Bumsu Hyeon Date: Thu, 13 Jan 2022 21:23:25 +0900 Subject: [PATCH] vfs/cache: fix handling of special characters in file names (#5875) --- vfs/vfscache/cache.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vfs/vfscache/cache.go b/vfs/vfscache/cache.go index 50c32bfc2..dc1b73f14 100644 --- a/vfs/vfscache/cache.go +++ b/vfs/vfscache/cache.go @@ -196,7 +196,6 @@ func createRootDirs(parentOSPath string, relativeDirOSPath string) (dataOSPath s // Returns an os path for the data cache file. func (c *Cache) createItemDir(name string) (string, error) { parent := vfscommon.FindParent(name) - leaf := filepath.Base(name) parentPath := c.toOSPath(parent) err := createDir(parentPath) if err != nil { @@ -207,7 +206,7 @@ func (c *Cache) createItemDir(name string) (string, error) { if err != nil { return "", fmt.Errorf("failed to create metadata cache item directory: %w", err) } - return filepath.Join(parentPath, leaf), nil + return c.toOSPath(name), nil } // getBackend gets a backend for a cache root dir