aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_put.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-25 12:25:29 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-25 12:45:00 +0100
commitc99f55c4204c81f1a8c368e24b434e02a676a96d (patch)
tree62e9c8ae18594b2049a7b3f189baa87e297a6ae2 /src/api/s3_put.rs
parentacdf893362196125729cd5ec7a6feb7fe5668e9a (diff)
downloadgarage-c99f55c4204c81f1a8c368e24b434e02a676a96d.tar.gz
garage-c99f55c4204c81f1a8c368e24b434e02a676a96d.zip
Add restriction on part ordering in CompleteMultipartUploadv0.6.0-rc1get-head-part-number
Diffstat (limited to 'src/api/s3_put.rs')
-rw-r--r--src/api/s3_put.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/api/s3_put.rs b/src/api/s3_put.rs
index f52080a6..a6863cd3 100644
--- a/src/api/s3_put.rs
+++ b/src/api/s3_put.rs
@@ -559,6 +559,17 @@ pub async fn handle_complete_multipart_upload(
return Err(Error::InvalidPartOrder);
}
+ // Garage-specific restriction, see #204: part numbers must be
+ // consecutive starting at 1
+ if body_list_of_parts[0].part_number != 1
+ || !body_list_of_parts
+ .iter()
+ .zip(body_list_of_parts.iter().skip(1))
+ .all(|(p1, p2)| p1.part_number + 1 == p2.part_number)
+ {
+ return Err(Error::NotImplemented("Garage does not support completing a Multipart upload with non-consecutive part numbers. This is a restriction of Garage's data model, which might be fixed in a future release. See issue #204 for more information on this topic.".into()));
+ }
+
// Check that the list of parts they gave us corresponds to the parts we have here
debug!("Expected parts from request: {:?}", body_list_of_parts);
debug!("Parts stored in version: {:?}", version.parts_etags.items());