From 4792e07228382666c600fa338e254a35fc7b54d4 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 20 Apr 2022 09:32:17 -0700 Subject: [PATCH] fix index out of range --- weed/iamapi/iamapi_management_handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go index 5fea49f5c..ff6fc4c61 100644 --- a/weed/iamapi/iamapi_management_handlers.go +++ b/weed/iamapi/iamapi_management_handlers.go @@ -382,7 +382,7 @@ func (iama *IamApiServer) DeleteAccessKey(s3cfg *iam_pb.S3ApiConfiguration, valu // "If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web // Services access key ID signing the request." func handleImplicitUsername(r *http.Request, values url.Values) { - if values.Get("UserName") == "" { + if values.Get("UserName") == "" && len(r.Header["Authorization"]) > 0 { // get username who signs the request userName := strings.Split(r.Header["Authorization"][0], "/")[2] values.Set("UserName", userName)