diff --git a/cmd/bucket-notification-handlers_test.go b/cmd/bucket-notification-handlers_test.go
index ba082d333..95495389b 100644
--- a/cmd/bucket-notification-handlers_test.go
+++ b/cmd/bucket-notification-handlers_test.go
@@ -174,7 +174,7 @@ func testGetBucketNotificationHandler(obj ObjectLayer, instanceType string, t Te
// get random bucket name.
randBucket := getRandomBucketName()
noNotificationBucket := "nonotification"
- invalidBucket := "Invalid^Bucket"
+ invalidBucket := "Invalid\\Bucket"
// Create buckets for the following test cases.
for _, bucket := range []string{randBucket, noNotificationBucket} {
@@ -326,7 +326,7 @@ func TestGetBucketNotificationHandler(t *testing.T) {
}
func testPutBucketNotificationHandler(obj ObjectLayer, instanceType string, t TestErrHandler) {
- invalidBucket := "Invalid^Bucket"
+ invalidBucket := "Invalid\\Bucket"
// get random bucket name.
randBucket := getRandomBucketName()
@@ -483,7 +483,7 @@ func TestPutBucketNotificationHandler(t *testing.T) {
}
func testListenBucketNotificationHandler(obj ObjectLayer, instanceType string, t TestErrHandler) {
- invalidBucket := "Invalid^Bucket"
+ invalidBucket := "Invalid\\Bucket"
noNotificationBucket := "nonotificationbucket"
// get random bucket name.
randBucket := getRandomBucketName()
@@ -629,7 +629,7 @@ func TestListenBucketNotificationHandler(t *testing.T) {
}
func testRemoveNotificationConfig(obj ObjectLayer, instanceType string, t TestErrHandler) {
- invalidBucket := "Invalid^Bucket"
+ invalidBucket := "Invalid\\Bucket"
// get random bucket name.
randBucket := getRandomBucketName()
diff --git a/cmd/fs-v1_test.go b/cmd/fs-v1_test.go
index af5850858..10af51d2a 100644
--- a/cmd/fs-v1_test.go
+++ b/cmd/fs-v1_test.go
@@ -194,7 +194,7 @@ func TestFSDeleteObject(t *testing.T) {
t.Fatal("Unexpected error: ", err)
}
// Test with invalid object name
- if err := fs.DeleteObject(bucketName, "^"); !isSameType(errorCause(err), ObjectNameInvalid{}) {
+ if err := fs.DeleteObject(bucketName, "\\"); !isSameType(errorCause(err), ObjectNameInvalid{}) {
t.Fatal("Unexpected error: ", err)
}
// Test with inexist bucket/object
diff --git a/cmd/object-api-listobjects_test.go b/cmd/object-api-listobjects_test.go
index 0e8b3fcf3..1dc8983da 100644
--- a/cmd/object-api-listobjects_test.go
+++ b/cmd/object-api-listobjects_test.go
@@ -514,7 +514,7 @@ func testListObjects(obj ObjectLayer, instanceType string, t TestErrHandler) {
{"test-bucket-list-object", "/", "", "/", 10, resultCases[30], nil, true},
// Test with invalid prefix (61)
- {"test-bucket-list-object", "^", "", "/", 10, resultCases[30], ObjectNameInvalid{Bucket: "test-bucket-list-object", Object: "^"}, false},
+ {"test-bucket-list-object", "\\", "", "/", 10, resultCases[30], ObjectNameInvalid{Bucket: "test-bucket-list-object", Object: "\\"}, false},
}
for i, testCase := range testCases {
diff --git a/cmd/object-api-multipart_test.go b/cmd/object-api-multipart_test.go
index afe9073b6..372288d59 100644
--- a/cmd/object-api-multipart_test.go
+++ b/cmd/object-api-multipart_test.go
@@ -58,7 +58,7 @@ func testObjectNewMultipartUpload(obj ObjectLayer, instanceType string, t TestEr
t.Fatalf("%s : %s", instanceType, err.Error())
}
- _, err = obj.NewMultipartUpload(bucket, "^", nil)
+ _, err = obj.NewMultipartUpload(bucket, "\\", nil)
if err == nil {
t.Fatalf("%s: Expected to fail since object name is invalid.", instanceType)
}
@@ -109,7 +109,7 @@ func testObjectAbortMultipartUpload(obj ObjectLayer, instanceType string, t Test
expectedErrType error
}{
{"--", object, uploadID, BucketNameInvalid{}},
- {bucket, "^", uploadID, ObjectNameInvalid{}},
+ {bucket, "\\", uploadID, ObjectNameInvalid{}},
{"foo", object, uploadID, BucketNotFound{}},
{bucket, object, "foo-foo", InvalidUploadID{}},
{bucket, object, uploadID, nil},
diff --git a/cmd/object-utils.go b/cmd/object-utils.go
index 36e71e0c3..c70666877 100644
--- a/cmd/object-utils.go
+++ b/cmd/object-utils.go
@@ -75,11 +75,8 @@ func IsValidBucketName(bucket string) bool {
// Rejects strings with following characters.
//
// - Backslash ("\")
-// - Caret ("^")
-// - Grave accent / back tick ("`")
-// - Vertical bar / pipe ("|")
//
-// Minio does not support object names with trailing "/".
+// additionally minio does not support object names with trailing "/".
func IsValidObjectName(object string) bool {
if len(object) == 0 {
return false
@@ -103,7 +100,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
diff --git a/cmd/object-utils_test.go b/cmd/object-utils_test.go
index 8bb85a41e..f4d5cc69f 100644
--- a/cmd/object-utils_test.go
+++ b/cmd/object-utils_test.go
@@ -46,7 +46,7 @@ func TestIsValidBucketName(t *testing.T) {
{"192.168.1.1", false},
{"$this-is-not-valid-too", false},
{"contains-$-dollar", false},
- {"contains-^-carrot", false},
+ {"contains-^-carret", false},
{"contains-$-dollar", false},
{"contains-$-dollar", false},
{"......", false},
@@ -89,12 +89,17 @@ func TestIsValidObjectName(t *testing.T) {
{"117Gn8rfHL2ACARPAhaFd0AGzic9pUbIA/5OCn5A", true},
{"SHØRT", true},
{"f*le", true},
+ {"contains-^-carret", true},
+ {"contains-|-pipe", true},
+ {"contains-\"-quote", true},
+ {"contains-`-tick", 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.
{"", false},
{"a/b/c/", false},
{"/a/b/c", false},
+ {"contains-\\-backslash", false},
{string([]byte{0xff, 0xfe, 0xfd}), false},
}
diff --git a/cmd/server_test.go b/cmd/server_test.go
index 2d5d6da82..41ada0864 100644
--- a/cmd/server_test.go
+++ b/cmd/server_test.go
@@ -176,7 +176,7 @@ func (s *TestSuiteCommon) TestBucketSNSNotification(c *C) {
verifyError(c, response, "InvalidArgument", "filter rule name must be either prefix or suffix", http.StatusBadRequest)
- invalidBucketNotificationBuf = `s3:ObjectCreated:Putprefix|||1arn:minio:sns:us-east-1:1:listen`
+ invalidBucketNotificationBuf = `s3:ObjectCreated:Putprefixhello\1arn:minio:sns:us-east-1:1:listen`
request, err = newTestSignedRequestV4("PUT", getPutNotificationURL(s.endPoint, bucketName),
int64(len(invalidBucketNotificationBuf)), bytes.NewReader([]byte(invalidBucketNotificationBuf)), s.accessKey, s.secretKey)
diff --git a/cmd/server_v2_test.go b/cmd/server_v2_test.go
index 391789c53..9008bf9b8 100644
--- a/cmd/server_v2_test.go
+++ b/cmd/server_v2_test.go
@@ -173,7 +173,7 @@ func (s *TestSuiteCommonV2) TestBucketSNSNotification(c *C) {
verifyError(c, response, "InvalidArgument", "filter rule name must be either prefix or suffix", http.StatusBadRequest)
- invalidBucketNotificationBuf = `s3:ObjectCreated:Putprefix|||1arn:minio:sns:us-east-1:1:listen`
+ invalidBucketNotificationBuf = `s3:ObjectCreated:Putprefixhello\1arn:minio:sns:us-east-1:1:listen`
request, err = newTestSignedRequestV2("PUT", getPutNotificationURL(s.endPoint, bucketName),
int64(len(invalidBucketNotificationBuf)), bytes.NewReader([]byte(invalidBucketNotificationBuf)), s.accessKey, s.secretKey)