IsValidObjectPrefix verifies whether the prefix is a valid object name. Its valid to have a empty prefix.
(object string)
| 161 | // IsValidObjectPrefix verifies whether the prefix is a valid object name. |
| 162 | // Its valid to have a empty prefix. |
| 163 | func 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 |
| 181 | func checkObjectNameForLengthAndSlash(bucket, object string) error { |
no test coverage detected