aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex <lx@deuxfleurs.fr>2025-02-14 17:16:58 +0000
committerAlex <lx@deuxfleurs.fr>2025-02-14 17:16:58 +0000
commit89c944ebd6a08f27dae44d16e81c9487ec9f9c30 (patch)
treea27d906862af41774ffe81a56922222a70e3a776 /src
parenta94adf804f79f8dcc0c704b4c061b8f79df7c88a (diff)
parent165f9316e2c1414f27d04fd7c86bf628dc6a096d (diff)
downloadgarage-89c944ebd6a08f27dae44d16e81c9487ec9f9c30.tar.gz
garage-89c944ebd6a08f27dae44d16e81c9487ec9f9c30.zip
Merge pull request 's3api: return Location in CompleteMultipartUpload (fix #852)' (#958) from fix-852 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/958
Diffstat (limited to 'src')
-rw-r--r--src/api/s3/multipart.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/api/s3/multipart.rs b/src/api/s3/multipart.rs
index fe39fc93..fa053df2 100644
--- a/src/api/s3/multipart.rs
+++ b/src/api/s3/multipart.rs
@@ -430,7 +430,16 @@ pub async fn handle_complete_multipart_upload(
// Send response saying ok we're done
let result = s3_xml::CompleteMultipartUploadResult {
xmlns: (),
- location: None,
+ // FIXME: the location returned is not always correct:
+ // - we always return https, but maybe some people do http
+ // - if root_domain is not specified, a full URL is not returned
+ location: garage
+ .config
+ .s3_api
+ .root_domain
+ .as_ref()
+ .map(|rd| s3_xml::Value(format!("https://{}.{}/{}", bucket_name, rd, key)))
+ .or(Some(s3_xml::Value(format!("/{}/{}", bucket_name, key)))),
bucket: s3_xml::Value(bucket_name.to_string()),
key: s3_xml::Value(key),
etag: s3_xml::Value(format!("\"{}\"", etag)),