From 6b2612690bb3e80d767029b9f6a8ab9b34977811 Mon Sep 17 00:00:00 2001 From: chrislu Date: Wed, 20 Nov 2024 23:11:16 -0800 Subject: [PATCH] consistent error message if auth is not setup fix https://github.com/seaweedfs/seaweedfs/issues/6262 --- weed/s3api/s3api_object_handlers_multipart.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/weed/s3api/s3api_object_handlers_multipart.go b/weed/s3api/s3api_object_handlers_multipart.go index 6fecdcf2d..8a274d72c 100644 --- a/weed/s3api/s3api_object_handlers_multipart.go +++ b/weed/s3api/s3api_object_handlers_multipart.go @@ -228,8 +228,8 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ } dataReader := r.Body + rAuthType := getRequestAuthType(r) if s3a.iam.isEnabled() { - rAuthType := getRequestAuthType(r) var s3ErrCode s3err.ErrorCode switch rAuthType { case authTypeStreamingSigned: @@ -243,6 +243,11 @@ func (s3a *S3ApiServer) PutObjectPartHandler(w http.ResponseWriter, r *http.Requ s3err.WriteErrorResponse(w, r, s3ErrCode) return } + } else { + if authTypeStreamingSigned == rAuthType { + s3err.WriteErrorResponse(w, r, s3err.ErrAuthNotSetup) + return + } } defer dataReader.Close()