fix: empty fileName cause Reader nil for PostPolicyBucketHandler (#21323)

This commit is contained in:
jiuker 2025-05-27 23:18:26 +08:00 committed by GitHub
parent 816666a4c6
commit 9f24ca5d66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1089,6 +1089,14 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h
break
}
// check if have a file
if reader == nil {
apiErr := errorCodes.ToAPIErr(ErrMalformedPOSTRequest)
apiErr.Description = fmt.Sprintf("%s (%v)", apiErr.Description, errors.New("The file or text content is missing"))
writeErrorResponse(ctx, w, apiErr, r.URL)
return
}
if keyName, ok := formValues["Key"]; !ok {
apiErr := errorCodes.ToAPIErr(ErrMalformedPOSTRequest)
apiErr.Description = fmt.Sprintf("%s (%v)", apiErr.Description, errors.New("The name of the uploaded key is missing"))