aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_list.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-26 18:55:13 +0000
committerAlex Auvolat <alex@adnab.me>2020-04-26 18:55:13 +0000
commit9cb870f950504b142e2954d2e1eb76929aaf689f (patch)
treef63d8039ec33644f061add4dcf046717e0be2a75 /src/api/s3_list.rs
parentea7e4748edb32bcbcf737dcf35322eb6496b3439 (diff)
downloadgarage-9cb870f950504b142e2954d2e1eb76929aaf689f.tar.gz
garage-9cb870f950504b142e2954d2e1eb76929aaf689f.zip
Prepare for multipart uploads
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r--src/api/s3_list.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs
index b4ee0919..184168f3 100644
--- a/src/api/s3_list.rs
+++ b/src/api/s3_list.rs
@@ -8,7 +8,6 @@ use hyper::Response;
use garage_util::error::Error;
use garage_core::garage::Garage;
-use garage_core::object_table::*;
use crate::api_server::BodyType;
use crate::http_util::*;
@@ -44,11 +43,7 @@ pub async fn handle_list(
)
.await?;
for object in objects.iter() {
- if let Some(version) = object
- .versions()
- .iter()
- .find(|x| x.is_complete && x.data != ObjectVersionData::DeleteMarker)
- {
+ if let Some(version) = object.versions().iter().find(|x| x.is_data()) {
if !object.key.starts_with(prefix) {
truncated = false;
break;
@@ -56,7 +51,7 @@ pub async fn handle_list(
let common_prefix = if delimiter.len() > 0 {
let relative_key = &object.key[prefix.len()..];
match relative_key.find(delimiter) {
- Some(i) => Some(&object.key[..prefix.len()+i+delimiter.len()]),
+ Some(i) => Some(&object.key[..prefix.len() + i + delimiter.len()]),
None => None,
}
} else {
@@ -70,7 +65,9 @@ pub async fn handle_list(
last_modified: version.timestamp,
size: version.size,
},
- Some(_lri) => return Err(Error::Message(format!("Duplicate key?? {}", object.key))),
+ Some(_lri) => {
+ return Err(Error::Message(format!("Duplicate key?? {}", object.key)))
+ }
};
result_keys.insert(object.key.clone(), info);
};
@@ -117,7 +114,7 @@ pub async fn handle_list(
writeln!(&mut xml, "</ListBucketResult>").unwrap();
Ok(Response::new(Box::new(BytesBody::from(xml.into_bytes()))))
-}
+}
fn xml_escape(s: &str) -> String {
s.replace("<", "&lt;")
.replace(">", "&gt;")