s3: Return XMinioInvalidObjectName if the object contains null char (#16372)

This commit is contained in:
Anis Elleuch 2023-01-06 19:11:18 +01:00 committed by GitHub
parent 57fd02ee57
commit ebd4388cca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,6 +170,13 @@ func IsValidObjectPrefix(object string) bool {
if strings.Contains(object, `//`) { if strings.Contains(object, `//`) {
return false return false
} }
// This is valid for AWS S3 but it will never
// work with file systems, we will reject here
// to return object name invalid rather than
// a cryptic error from the file system.
if strings.ContainsRune(object, 0) {
return false
}
return true return true
} }