Browse Source

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

* fix: set user metadata key to lowercase

* feat: simplify a bit
pull/3905/head
famosss 2 years ago
committed by GitHub
parent
commit
25e012d30b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      weed/s3api/s3api_object_handlers.go

12
weed/s3api/s3api_object_handlers.go

@ -409,10 +409,22 @@ func (s3a *S3ApiServer) proxyToFiler(w http.ResponseWriter, r *http.Request, des
return return
} }
setUserMetadataKeyToLowercase(resp)
responseStatusCode := responseFn(resp, w) responseStatusCode := responseFn(resp, w)
s3err.PostLog(r, responseStatusCode, s3err.ErrNone) 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) { func passThroughResponse(proxyResponse *http.Response, w http.ResponseWriter) (statusCode int) {
for k, v := range proxyResponse.Header { for k, v := range proxyResponse.Header {
w.Header()[k] = v w.Header()[k] = v

Loading…
Cancel
Save