s3 api: make x-amz-meta-* headers lowercase (fix #844)
This commit is contained in:
parent
d4e3e60920
commit
e8fa89e834
2 changed files with 6 additions and 9 deletions
|
@ -68,14 +68,11 @@ fn object_headers(
|
||||||
// See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html
|
// See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html
|
||||||
let mut headers_by_name = BTreeMap::new();
|
let mut headers_by_name = BTreeMap::new();
|
||||||
for (name, value) in meta_inner.headers.iter() {
|
for (name, value) in meta_inner.headers.iter() {
|
||||||
match headers_by_name.get_mut(name) {
|
let name_lower = name.to_ascii_lowercase();
|
||||||
None => {
|
headers_by_name
|
||||||
headers_by_name.insert(name, vec![value.as_str()]);
|
.entry(name_lower)
|
||||||
}
|
.or_insert(vec![])
|
||||||
Some(headers) => {
|
.push(value.as_str());
|
||||||
headers.push(value.as_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name, values) in headers_by_name {
|
for (name, values) in headers_by_name {
|
||||||
|
|
|
@ -622,7 +622,7 @@ pub(crate) fn get_headers(headers: &HeaderMap<HeaderValue>) -> Result<HeaderList
|
||||||
for (name, value) in headers.iter() {
|
for (name, value) in headers.iter() {
|
||||||
if name.as_str().starts_with("x-amz-meta-") {
|
if name.as_str().starts_with("x-amz-meta-") {
|
||||||
ret.push((
|
ret.push((
|
||||||
name.to_string(),
|
name.as_str().to_ascii_lowercase(),
|
||||||
std::str::from_utf8(value.as_bytes())?.to_string(),
|
std::str::from_utf8(value.as_bytes())?.to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue