Vendorize with bug fixes from minio browser. (#3341)

This patch brings in changes from miniobrowser repo.

- Bucket policy UI and functionality fixes by @krishnasrinivas
- Bucket policy implementation by @balamurugana
- UI changes and new functionality changing password etc. @rushenn
- UI and new functionality for sharing URLs, deleting files
  @rushenn and @krishnasrinivas.
- Other misc fixes by @vadmeste @brendanashworth
This commit is contained in:
Harshavardhana 2016-11-23 17:31:11 -08:00 committed by GitHub
parent e2ef95af7d
commit 12c1abed98
5 changed files with 92 additions and 46 deletions

View File

@ -549,7 +549,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{
}, },
ErrPolicyNesting: { ErrPolicyNesting: {
Code: "XMinioPolicyNesting", 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, HTTPStatusCode: http.StatusConflict,
}, },
ErrInvalidObjectName: { ErrInvalidObjectName: {

View File

@ -325,6 +325,13 @@ func (e NotImplemented) Error() string {
return "Not Implemented" 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. // Check if error type is IncompleteBody.
func isErrIncompleteBody(err error) bool { func isErrIncompleteBody(err error) bool {
err = errorCause(err) err = errorCause(err)

View File

@ -696,13 +696,19 @@ func (web *webAPIHandlers) SetBucketPolicy(r *http.Request, args *SetBucketPolic
err = parseBucketPolicy(bytes.NewReader(data), policy) err = parseBucketPolicy(bytes.NewReader(data), policy)
if err != nil { if err != nil {
errorIf(err, "Unable to parse bucket policy.") errorIf(err, "Unable to parse bucket policy.")
return toJSONError(err) return toJSONError(err, args.BucketName)
} }
// Parse check bucket policy. // Parse check bucket policy.
if s3Error := checkBucketPolicyResources(args.BucketName, policy); s3Error != ErrNone { if s3Error := checkBucketPolicyResources(args.BucketName, policy); s3Error != ErrNone {
apiErr := getAPIError(s3Error) 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, // TODO: update policy statements according to bucket name,
@ -850,6 +856,8 @@ func toWebAPIError(err error) APIError {
apiErrCode = ErrStorageFull apiErrCode = ErrStorageFull
case BucketNotFound: case BucketNotFound:
apiErrCode = ErrNoSuchBucket apiErrCode = ErrNoSuchBucket
case BucketExists:
apiErrCode = ErrBucketAlreadyOwnedByYou
case BucketNameInvalid: case BucketNameInvalid:
apiErrCode = ErrInvalidBucketName apiErrCode = ErrInvalidBucketName
case BadDigest: case BadDigest:
@ -866,7 +874,11 @@ func toWebAPIError(err error) APIError {
apiErrCode = ErrWriteQuorum apiErrCode = ErrWriteQuorum
case InsufficientReadQuorum: case InsufficientReadQuorum:
apiErrCode = ErrReadQuorum apiErrCode = ErrReadQuorum
case PolicyNesting:
apiErrCode = ErrPolicyNesting
default: default:
// Log unexpected and unhandled errors.
errorIf(err, errUnexpected.Error())
apiErrCode = ErrInternalError apiErrCode = ErrInternalError
} }
apiErr := getAPIError(apiErrCode) apiErr := getAPIError(apiErrCode)

File diff suppressed because one or more lines are too long

6
vendor/vendor.json vendored
View File

@ -139,10 +139,10 @@
"revisionTime": "2016-08-18T00:31:20Z" "revisionTime": "2016-08-18T00:31:20Z"
}, },
{ {
"checksumSHA1": "Gok4D2jDvlfXeygOMO+7G9isas0=", "checksumSHA1": "Npl9R1pdTKB5LDiGh/hls8nMNQc=",
"path": "github.com/minio/miniobrowser", "path": "github.com/minio/miniobrowser",
"revision": "9d4da540a5d8fd8762c53cdc8b11d3f543eac73a", "revision": "d9214007ee7c5404358031c3e5af7df69300f874",
"revisionTime": "2016-10-15T15:17:03Z" "revisionTime": "2016-11-24T00:39:49Z"
}, },
{ {
"checksumSHA1": "GOSe2XEQI4AYwrMoLZu8vtmzkJM=", "checksumSHA1": "GOSe2XEQI4AYwrMoLZu8vtmzkJM=",