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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
0 deletions
-
weed/s3api/s3api_object_handlers.go
|
|
@ -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 |
|
|
|