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.
master
Anis Elleuch 5 years ago committed by GitHub
parent 2bbc6a83e8
commit e51e465543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/posix.go

@ -1452,10 +1452,7 @@ func deleteFile(basePath, deletePath string, recursive bool) error {
} }
} }
// Trailing slash is removed when found to ensure deletePath = filepath.Dir(deletePath)
// slashpath.Dir() to work as intended.
deletePath = strings.TrimSuffix(deletePath, SlashSeparator)
deletePath = slashpath.Dir(deletePath)
// Delete parent directory obviously not recursively. Errors for // Delete parent directory obviously not recursively. Errors for
// parent directories shouldn't trickle down. // parent directories shouldn't trickle down.

Loading…
Cancel
Save