posix: reserved files should be filtered out at posix not object layer. (#1554)

master
Harshavardhana 9 years ago
parent 722abe2d0f
commit 9d41414fb5
  1. 4
      posix-list-dir-nix.go
  2. 4
      posix-list-dir-others.go
  3. 3
      tree-walk.go

@ -69,6 +69,10 @@ func parseDirents(dirPath string, buf []byte) (entries []string, err error) {
if name == "." || name == ".." { if name == "." || name == ".." {
continue continue
} }
// Skip special files.
if hasReservedPrefix(name) || hasReservedSuffix(name) {
continue
}
switch dirent.Type { switch dirent.Type {
case syscall.DT_DIR: case syscall.DT_DIR:

@ -56,6 +56,10 @@ func readDir(dirPath string) (entries []string, err error) {
return nil, err return nil, err
} }
for _, fi := range fis { for _, fi := range fis {
// Skip special files.
if hasReservedPrefix(fi.Name()) || hasReservedSuffix(fi.Name()) {
continue
}
if fi.Mode().IsDir() { if fi.Mode().IsDir() {
// append "/" instead of "\" so that sorting is done as expected. // append "/" instead of "\" so that sorting is done as expected.
entries = append(entries, fi.Name()+slashSeparator) entries = append(entries, fi.Name()+slashSeparator)

@ -123,9 +123,6 @@ func treeWalk(layer ObjectLayer, bucket, prefixDir, entryPrefixMatch, marker str
if !strings.HasPrefix(entry, entryPrefixMatch) { if !strings.HasPrefix(entry, entryPrefixMatch) {
entries[i] = "" entries[i] = ""
} }
if hasReservedPrefix(entry) || hasReservedSuffix(entry) {
entries[i] = ""
}
} }
} }
// For XL multipart files strip the trailing "/" and append ".minio.multipart" to the entry so that // For XL multipart files strip the trailing "/" and append ".minio.multipart" to the entry so that

Loading…
Cancel
Save