forked from Deuxfleurs/garage
Merge pull request 'post_object.rs: Fixed typos / grammar.' (#607) from jpds/garage:post-objects-typos into main
Reviewed-on: Deuxfleurs/garage#607
This commit is contained in:
commit
67b1457c77
1 changed files with 5 additions and 7 deletions
|
@ -30,7 +30,7 @@ pub async fn handle_post_object(
|
||||||
.get(header::CONTENT_TYPE)
|
.get(header::CONTENT_TYPE)
|
||||||
.and_then(|ct| ct.to_str().ok())
|
.and_then(|ct| ct.to_str().ok())
|
||||||
.and_then(|ct| multer::parse_boundary(ct).ok())
|
.and_then(|ct| multer::parse_boundary(ct).ok())
|
||||||
.ok_or_bad_request("Counld not get multipart boundary")?;
|
.ok_or_bad_request("Could not get multipart boundary")?;
|
||||||
|
|
||||||
// 16k seems plenty for a header. 5G is the max size of a single part, so it seems reasonable
|
// 16k seems plenty for a header. 5G is the max size of a single part, so it seems reasonable
|
||||||
// for a PostObject
|
// for a PostObject
|
||||||
|
@ -64,15 +64,13 @@ pub async fn handle_post_object(
|
||||||
"tag" => (/* tag need to be reencoded, but we don't support them yet anyway */),
|
"tag" => (/* tag need to be reencoded, but we don't support them yet anyway */),
|
||||||
"acl" => {
|
"acl" => {
|
||||||
if params.insert("x-amz-acl", content).is_some() {
|
if params.insert("x-amz-acl", content).is_some() {
|
||||||
return Err(Error::bad_request(
|
return Err(Error::bad_request("Field 'acl' provided more than once"));
|
||||||
"Field 'acl' provided more than one time",
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
if params.insert(&name, content).is_some() {
|
if params.insert(&name, content).is_some() {
|
||||||
return Err(Error::bad_request(format!(
|
return Err(Error::bad_request(format!(
|
||||||
"Field '{}' provided more than one time",
|
"Field '{}' provided more than once",
|
||||||
name
|
name
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
@ -149,7 +147,7 @@ pub async fn handle_post_object(
|
||||||
.ok_or_bad_request("Invalid expiration date")?
|
.ok_or_bad_request("Invalid expiration date")?
|
||||||
.into();
|
.into();
|
||||||
if Utc::now() - expiration > Duration::zero() {
|
if Utc::now() - expiration > Duration::zero() {
|
||||||
return Err(Error::bad_request("Expiration date is in the paste"));
|
return Err(Error::bad_request("Expiration date is in the past"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut conditions = decoded_policy.into_conditions()?;
|
let mut conditions = decoded_policy.into_conditions()?;
|
||||||
|
@ -330,7 +328,7 @@ impl Policy {
|
||||||
if map.len() != 1 {
|
if map.len() != 1 {
|
||||||
return Err(Error::bad_request("Invalid policy item"));
|
return Err(Error::bad_request("Invalid policy item"));
|
||||||
}
|
}
|
||||||
let (mut k, v) = map.into_iter().next().expect("size was verified");
|
let (mut k, v) = map.into_iter().next().expect("Size could not be verified");
|
||||||
k.make_ascii_lowercase();
|
k.make_ascii_lowercase();
|
||||||
params.entry(k).or_default().push(Operation::Equal(v));
|
params.entry(k).or_default().push(Operation::Equal(v));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue