From 9d41414fb5b3b5b442c7c505d15e0c14faee3671 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 9 May 2016 02:53:08 -0700 Subject: [PATCH] posix: reserved files should be filtered out at posix not object layer. (#1554) --- posix-list-dir-nix.go | 4 ++++ posix-list-dir-others.go | 4 ++++ tree-walk.go | 3 --- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/posix-list-dir-nix.go b/posix-list-dir-nix.go index 1991428e4..24818fa15 100644 --- a/posix-list-dir-nix.go +++ b/posix-list-dir-nix.go @@ -69,6 +69,10 @@ func parseDirents(dirPath string, buf []byte) (entries []string, err error) { if name == "." || name == ".." { continue } + // Skip special files. + if hasReservedPrefix(name) || hasReservedSuffix(name) { + continue + } switch dirent.Type { case syscall.DT_DIR: diff --git a/posix-list-dir-others.go b/posix-list-dir-others.go index 25d74a714..2a0b7ebf7 100644 --- a/posix-list-dir-others.go +++ b/posix-list-dir-others.go @@ -56,6 +56,10 @@ func readDir(dirPath string) (entries []string, err error) { return nil, err } for _, fi := range fis { + // Skip special files. + if hasReservedPrefix(fi.Name()) || hasReservedSuffix(fi.Name()) { + continue + } if fi.Mode().IsDir() { // append "/" instead of "\" so that sorting is done as expected. entries = append(entries, fi.Name()+slashSeparator) diff --git a/tree-walk.go b/tree-walk.go index 85f2e4103..ea47a265d 100644 --- a/tree-walk.go +++ b/tree-walk.go @@ -123,9 +123,6 @@ func treeWalk(layer ObjectLayer, bucket, prefixDir, entryPrefixMatch, marker str if !strings.HasPrefix(entry, entryPrefixMatch) { 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