diff --git a/cmd/api-errors.go b/cmd/api-errors.go
index 02657ebf3..d22f05040 100644
--- a/cmd/api-errors.go
+++ b/cmd/api-errors.go
@@ -549,7 +549,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{
},
ErrPolicyNesting: {
Code: "XMinioPolicyNesting",
- Description: "Policy nesting conflict has occurred.",
+ Description: "New bucket policy conflicts with an existing policy. Please try again with new prefix.",
HTTPStatusCode: http.StatusConflict,
},
ErrInvalidObjectName: {
diff --git a/cmd/object-errors.go b/cmd/object-errors.go
index 4459c09c3..e98e08385 100644
--- a/cmd/object-errors.go
+++ b/cmd/object-errors.go
@@ -325,6 +325,13 @@ func (e NotImplemented) Error() string {
return "Not Implemented"
}
+// PolicyNesting - policy nesting conflict.
+type PolicyNesting struct{}
+
+func (e PolicyNesting) Error() string {
+ return "New bucket policy conflicts with an existing policy. Please try again with new prefix."
+}
+
// Check if error type is IncompleteBody.
func isErrIncompleteBody(err error) bool {
err = errorCause(err)
diff --git a/cmd/web-handlers.go b/cmd/web-handlers.go
index 5a4209a10..43801303e 100644
--- a/cmd/web-handlers.go
+++ b/cmd/web-handlers.go
@@ -696,13 +696,19 @@ func (web *webAPIHandlers) SetBucketPolicy(r *http.Request, args *SetBucketPolic
err = parseBucketPolicy(bytes.NewReader(data), policy)
if err != nil {
errorIf(err, "Unable to parse bucket policy.")
- return toJSONError(err)
+ return toJSONError(err, args.BucketName)
}
// Parse check bucket policy.
if s3Error := checkBucketPolicyResources(args.BucketName, policy); s3Error != ErrNone {
apiErr := getAPIError(s3Error)
- return toJSONError(errors.New(apiErr.Description), args.BucketName)
+ var err error
+ if apiErr.Code == "XMinioPolicyNesting" {
+ err = PolicyNesting{}
+ } else {
+ err = errors.New(apiErr.Description)
+ }
+ return toJSONError(err, args.BucketName)
}
// TODO: update policy statements according to bucket name,
@@ -850,6 +856,8 @@ func toWebAPIError(err error) APIError {
apiErrCode = ErrStorageFull
case BucketNotFound:
apiErrCode = ErrNoSuchBucket
+ case BucketExists:
+ apiErrCode = ErrBucketAlreadyOwnedByYou
case BucketNameInvalid:
apiErrCode = ErrInvalidBucketName
case BadDigest:
@@ -866,7 +874,11 @@ func toWebAPIError(err error) APIError {
apiErrCode = ErrWriteQuorum
case InsufficientReadQuorum:
apiErrCode = ErrReadQuorum
+ case PolicyNesting:
+ apiErrCode = ErrPolicyNesting
default:
+ // Log unexpected and unhandled errors.
+ errorIf(err, errUnexpected.Error())
apiErrCode = ErrInternalError
}
apiErr := getAPIError(apiErrCode)
diff --git a/vendor/github.com/minio/miniobrowser/ui-assets.go b/vendor/github.com/minio/miniobrowser/ui-assets.go
index d0676ecab..379c21770 100644
--- a/vendor/github.com/minio/miniobrowser/ui-assets.go
+++ b/vendor/github.com/minio/miniobrowser/ui-assets.go
@@ -4,7 +4,7 @@
// production/favicon.ico
// production/firefox.png
// production/index.html
-// production/index_bundle-2016-10-15T15-16-16Z.js
+// production/index_bundle-2016-11-24T00-39-02Z.js
// production/loader.css
// production/logo.svg
// production/safari.png
@@ -65,7 +65,7 @@ func productionChromePng() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/chrome.png", size: 3726, mode: os.FileMode(436), modTime: time.Unix(1476544589, 0)}
+ info := bindataFileInfo{name: "production/chrome.png", size: 3726, mode: os.FileMode(436), modTime: time.Unix(1479947956, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -82,7 +82,7 @@ func productionFaviconIco() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/favicon.ico", size: 1340, mode: os.FileMode(436), modTime: time.Unix(1476544589, 0)}
+ info := bindataFileInfo{name: "production/favicon.ico", size: 1340, mode: os.FileMode(436), modTime: time.Unix(1479947956, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -99,7 +99,7 @@ func productionFirefoxPng() (*asset, error) {
return nil, err
}
- info := bindataFileInfo{name: "production/firefox.png", size: 4795, mode: os.FileMode(436), modTime: time.Unix(1476544589, 0)}
+ info := bindataFileInfo{name: "production/firefox.png", size: 4795, mode: os.FileMode(436), modTime: time.Unix(1479947956, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
@@ -156,8 +156,8 @@ var _productionIndexHTML = []byte(`
-
-
+
+