mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
committed by
Nitish Tiwari
parent
bba562235b
commit
97f2bc26b9
@@ -136,7 +136,7 @@ func IsValidObjectName(object string) bool {
|
||||
if len(object) == 0 {
|
||||
return false
|
||||
}
|
||||
if hasSuffix(object, slashSeparator) || hasPrefix(object, slashSeparator) {
|
||||
if hasSuffix(object, slashSeparator) {
|
||||
return false
|
||||
}
|
||||
return IsValidObjectPrefix(object)
|
||||
@@ -148,9 +148,6 @@ func IsValidObjectPrefix(object string) bool {
|
||||
if hasBadPathComponent(object) {
|
||||
return false
|
||||
}
|
||||
if len(object) > 1024 {
|
||||
return false
|
||||
}
|
||||
if !utf8.ValidString(object) {
|
||||
return false
|
||||
}
|
||||
@@ -161,6 +158,25 @@ func IsValidObjectPrefix(object string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// checkObjectNameForLengthAndSlash -check for the validity of object name length and prefis as slash
|
||||
func checkObjectNameForLengthAndSlash(bucket, object string) error {
|
||||
// Check for the length of object name
|
||||
if len(object) > 1024 {
|
||||
return ObjectNameTooLong{
|
||||
Bucket: bucket,
|
||||
Object: object,
|
||||
}
|
||||
}
|
||||
// Check for slash as prefix in object name
|
||||
if hasPrefix(object, slashSeparator) {
|
||||
return ObjectNamePrefixAsSlash{
|
||||
Bucket: bucket,
|
||||
Object: object,
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Slash separator.
|
||||
const slashSeparator = "/"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user