From e51e46554373aac4b8214604eeae77dda228c7af Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 8 Apr 2020 19:32:58 +0100 Subject: [PATCH] delete: Use physical Dir() for proper prefix cleanup in Windows (#9297) In FS mode under Windows, removing an object will not automatically. remove parent empty prefixes. The reason is that path.Dir() was used, however filepath.Dir() is more appropriate since filepath is physical (meaning it operates on OS filesystem paths) This is not caught because failure for Windows CI is not caught. --- cmd/posix.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmd/posix.go b/cmd/posix.go index dbe934965..b6c09771e 100644 --- a/cmd/posix.go +++ b/cmd/posix.go @@ -1452,10 +1452,7 @@ func deleteFile(basePath, deletePath string, recursive bool) error { } } - // Trailing slash is removed when found to ensure - // slashpath.Dir() to work as intended. - deletePath = strings.TrimSuffix(deletePath, SlashSeparator) - deletePath = slashpath.Dir(deletePath) + deletePath = filepath.Dir(deletePath) // Delete parent directory obviously not recursively. Errors for // parent directories shouldn't trickle down.