MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / IsValidObjectPrefix

Function IsValidObjectPrefix

cmd/object-api-utils.go:163–178  ·  view source on GitHub ↗

IsValidObjectPrefix verifies whether the prefix is a valid object name. Its valid to have a empty prefix.

(object string)

Source from the content-addressed store, hash-verified

161// IsValidObjectPrefix verifies whether the prefix is a valid object name.
162// Its valid to have a empty prefix.
163func IsValidObjectPrefix(object string) bool {
164 if hasBadPathComponent(object) {
165 return false
166 }
167 if !utf8.ValidString(object) {
168 return false
169 }
170 if strings.Contains(object, `//`) {
171 return false
172 }
173 // This is valid for AWS S3 but it will never
174 // work with file systems, we will reject here
175 // to return object name invalid rather than
176 // a cryptic error from the file system.
177 return !strings.ContainsRune(object, 0)
178}
179
180// checkObjectNameForLengthAndSlash -check for the validity of object name length and prefis as slash
181func checkObjectNameForLengthAndSlash(bucket, object string) error {

Callers 6

validateListObjectsArgsFunction · 0.85
checkListObjsArgsFunction · 0.85
checkPutObjectArgsFunction · 0.85
IsValidObjectNameFunction · 0.85
extractHealInitParamsFunction · 0.85

Calls 2

hasBadPathComponentFunction · 0.85
ContainsMethod · 0.80

Tested by

no test coverage detected