|
|
@ -58,28 +58,14 @@ func isValidPath(path string) bool { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// List of reserved words for files, includes old and new ones.
|
|
|
|
// List of reserved words for files, includes old and new ones.
|
|
|
|
var reservedKeywords = []string{ |
|
|
|
var posixReservedPrefix = []string{ |
|
|
|
"$multiparts", |
|
|
|
|
|
|
|
"$tmpobject", |
|
|
|
|
|
|
|
"$tmpfile", |
|
|
|
"$tmpfile", |
|
|
|
// Add new reserved words if any used in future.
|
|
|
|
// Add new reserved words if any used in future.
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// hasReservedPrefix - returns true if name has a reserved keyword suffixed.
|
|
|
|
// hasPosixReservedPrefix - has reserved prefix.
|
|
|
|
func hasReservedSuffix(name string) (isReserved bool) { |
|
|
|
func hasPosixReservedPrefix(name string) (isReserved bool) { |
|
|
|
for _, reservedKey := range reservedKeywords { |
|
|
|
for _, reservedKey := range posixReservedPrefix { |
|
|
|
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 { |
|
|
|
|
|
|
|
if strings.HasPrefix(name, reservedKey) { |
|
|
|
if strings.HasPrefix(name, reservedKey) { |
|
|
|
isReserved = true |
|
|
|
isReserved = true |
|
|
|
break |
|
|
|
break |
|
|
|