Skip to content

Commit

Permalink
Allow asterisk character in key names (minio#2487)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadmeste authored and harshavardhana committed Aug 18, 2016
1 parent 95c16f5 commit 73d1a46
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions api-errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const (
ErrFilterNameInvalid
ErrFilterNamePrefix
ErrFilterNameSuffix
ErrFilterPrefixValueInvalid
ErrFilterValueInvalid

// S3 extended errors.
ErrContentSHA256Mismatch
Expand Down Expand Up @@ -500,9 +500,9 @@ var errorCodeResponse = map[APIErrorCode]APIError{
Description: "Cannot specify more than one suffix rule in a filter.",
HTTPStatusCode: http.StatusBadRequest,
},
ErrFilterPrefixValueInvalid: {
ErrFilterValueInvalid: {
Code: "InvalidArgument",
Description: "prefix rule value cannot exceed 1024 characters",
Description: "Size of filter rule value cannot exceed 1024 bytes in UTF-8 representation",
HTTPStatusCode: http.StatusBadRequest,
},

Expand Down
3 changes: 1 addition & 2 deletions bucket-notification-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ func checkFilterRules(filterRules []filterRule) APIErrorCode {
}
}

// Maximum prefix length can be up to 1,024 characters, validate.
if !IsValidObjectPrefix(filterRule.Value) {
return ErrFilterPrefixValueInvalid
return ErrFilterValueInvalid
}

// Set the new rule name to keep track of duplicates.
Expand Down
2 changes: 1 addition & 1 deletion object-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func IsValidObjectPrefix(object string) bool {
return false
}
// Reject unsupported characters in object name.
if strings.ContainsAny(object, "`^*|\\\"") {
if strings.ContainsAny(object, "`^|\\\"") {
return false
}
return true
Expand Down
1 change: 1 addition & 0 deletions object-utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestIsValidObjectName(t *testing.T) {
{"Cost Benefit Analysis (2009-2010).pptx", true},
{"117Gn8rfHL2ACARPAhaFd0AGzic9pUbIA/5OCn5A", true},
{"SHØRT", true},
{"f*le", true},
{"There are far too many object names, and far too few bucket names!", true},
// cases for which test should fail.
// passing invalid object names.
Expand Down

0 comments on commit 73d1a46

Please sign in to comment.