fix: set user metadata key to lowercase (#3894)

* fix: set user metadata key to lowercase

* feat: simplify a bit
This commit is contained in:
famosss 2022-10-25 08:29:52 +08:00 committed by GitHub
parent 091f999e8c
commit 25e012d30b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,10 +409,22 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
return
}
setUserMetadataKeyToLowercase(resp)
responseStatusCode := responseFn(resp, w)
s3err.PostLog(r, responseStatusCode, s3err.ErrNone)
}
func setUserMetadataKeyToLowercase(resp *http.Response) {
for key, value := range resp.Header {
if strings.HasPrefix(key, s3_constants.AmzUserMetaPrefix) {
resp.Header[strings.ToLower(key)] = value
delete(resp.Header,key)
continue
}
}
}
func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) (statusCode int) {
for k, v := range proxyResponse.Header {
w.Header()[k] = v