fix: check for xl.meta as directory fallback (#13023)

Objects uploaded in this format for example

```
mc cp /etc/hosts alias/bucket/foo/bar/xl.meta
mc ls -r alias/bucket/foo/bar
```

Won't list the object, handle this scenario.
This commit is contained in:
Harshavardhana
2021-08-21 00:12:29 -07:00
committed by GitHub
parent 16f7c64a9f
commit 0f01e7ef0f
3 changed files with 19 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ import (
"runtime"
"strings"
"sync"
"syscall"
"time"
"github.com/dustin/go-humanize"
@@ -405,6 +406,13 @@ func (s *xlStorage) readMetadata(itemPath string) ([]byte, error) {
if err != nil {
return nil, err
}
if stat.IsDir() {
return nil, &os.PathError{
Op: "open",
Path: itemPath,
Err: syscall.EISDIR,
}
}
return readXLMetaNoData(f, stat.Size())
}