avoid listing an empty dir without __XLDIR__ (#11427)

```
minio server /tmp/disk{1...4}
mc mb myminio/testbucket/
mkdir -p /tmp/disk{1..4}/testbucket/test-prefix/
```

This would end up being listed in the current
master, this PR fixes this situation.

If a directory is a leaf dir we should it
being listed, since it cannot be deleted anymore
with DeleteObject, DeleteObjects() API calls
because we natively support directories now.

Avoid listing it and let healing purge this folder
eventually in the background.
This commit is contained in:
Harshavardhana
2021-02-03 14:06:54 -08:00
committed by GitHub
parent b3f81e75f6
commit f71e192343

View File

@@ -209,7 +209,9 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
// NOT an object, append to stack (with slash) // NOT an object, append to stack (with slash)
// If dirObject, but no metadata (which is unexpected) we skip it. // If dirObject, but no metadata (which is unexpected) we skip it.
if !isDirObj { if !isDirObj {
dirStack = append(dirStack, meta.name+slashSeparator) if !isDirEmpty(pathJoin(volumeDir, meta.name+slashSeparator)) {
dirStack = append(dirStack, meta.name+slashSeparator)
}
} }
case isSysErrNotDir(err): case isSysErrNotDir(err):
// skip // skip