feat(api|web): persist x-amz-website-redirect-location directives

This offers to a user the possibility to PUT Object (and their copy
variants as long as the metadata directive is to REPLACE and not COPY)
with a redirection as per
https://docs.aws.amazon.com/AmazonS3/latest/userguide/how-to-page-redirect.html.

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
Raito Bezarius 2024-09-03 16:23:05 +02:00
parent 615698df7d
commit 647b2dae33

View file

@ -618,9 +618,11 @@ pub(crate) fn get_headers(headers: &HeaderMap<HeaderValue>) -> Result<HeaderList
} }
} }
// Preserve x-amz-meta- headers // Preserve x-amz-meta- and x-amz-website-redirect-location headers
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-")
|| name.as_str() == "x-amz-website-redirect-location"
{
ret.push(( ret.push((
name.to_string(), name.to_string(),
std::str::from_utf8(value.as_bytes())?.to_string(), std::str::from_utf8(value.as_bytes())?.to_string(),