mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
posix: remove dead code related to posix reserved suffixes. (#1555)
This commit is contained in:
parent
9d41414fb5
commit
6627388dc3
@ -70,7 +70,7 @@ func parseDirents(dirPath string, buf []byte) (entries []string, err error) {
|
||||
continue
|
||||
}
|
||||
// Skip special files.
|
||||
if hasReservedPrefix(name) || hasReservedSuffix(name) {
|
||||
if hasPosixReservedPrefix(name) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ func readDir(dirPath string) (entries []string, err error) {
|
||||
}
|
||||
for _, fi := range fis {
|
||||
// Skip special files.
|
||||
if hasReservedPrefix(fi.Name()) || hasReservedSuffix(fi.Name()) {
|
||||
if hasPosixReservedPrefix(fi.Name()) {
|
||||
continue
|
||||
}
|
||||
if fi.Mode().IsDir() {
|
||||
|
@ -58,28 +58,14 @@ func isValidPath(path string) bool {
|
||||
}
|
||||
|
||||
// List of reserved words for files, includes old and new ones.
|
||||
var reservedKeywords = []string{
|
||||
"$multiparts",
|
||||
"$tmpobject",
|
||||
var posixReservedPrefix = []string{
|
||||
"$tmpfile",
|
||||
// Add new reserved words if any used in future.
|
||||
}
|
||||
|
||||
// hasReservedPrefix - returns true if name has a reserved keyword suffixed.
|
||||
func hasReservedSuffix(name string) (isReserved bool) {
|
||||
for _, reservedKey := range reservedKeywords {
|
||||
if strings.HasSuffix(name, reservedKey) {
|
||||
isReserved = true
|
||||
break
|
||||
}
|
||||
isReserved = false
|
||||
}
|
||||
return isReserved
|
||||
}
|
||||
|
||||
// hasReservedPrefix - has reserved prefix.
|
||||
func hasReservedPrefix(name string) (isReserved bool) {
|
||||
for _, reservedKey := range reservedKeywords {
|
||||
// hasPosixReservedPrefix - has reserved prefix.
|
||||
func hasPosixReservedPrefix(name string) (isReserved bool) {
|
||||
for _, reservedKey := range posixReservedPrefix {
|
||||
if strings.HasPrefix(name, reservedKey) {
|
||||
isReserved = true
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user