S3 compatibility: return 404 instead of 400 on some multipart commands

This commit is contained in:
Alex Auvolat 2021-02-19 18:51:05 +01:00
parent 55a2a636ca
commit e64ecbdccd

View file

@ -384,9 +384,7 @@ pub async fn handle_put_part(
.iter() .iter()
.any(|v| v.uuid == version_uuid && v.is_uploading()) .any(|v| v.uuid == version_uuid && v.is_uploading())
{ {
return Err(Error::BadRequest(format!( return Err(Error::NotFound);
"Multipart upload does not exist or is otherwise invalid"
)));
} }
// Copy block to store // Copy block to store
@ -438,11 +436,7 @@ pub async fn handle_complete_multipart_upload(
.iter() .iter()
.find(|v| v.uuid == version_uuid && v.is_uploading()); .find(|v| v.uuid == version_uuid && v.is_uploading());
let mut object_version = match object_version { let mut object_version = match object_version {
None => { None => return Err(Error::NotFound),
return Err(Error::BadRequest(format!(
"Multipart upload does not exist or has already been completed"
)))
}
Some(x) => x.clone(), Some(x) => x.clone(),
}; };
@ -532,11 +526,7 @@ pub async fn handle_abort_multipart_upload(
.iter() .iter()
.find(|v| v.uuid == version_uuid && v.is_uploading()); .find(|v| v.uuid == version_uuid && v.is_uploading());
let mut object_version = match object_version { let mut object_version = match object_version {
None => { None => return Err(Error::NotFound),
return Err(Error::BadRequest(format!(
"Multipart upload does not exist or has already been completed"
)))
}
Some(x) => x.clone(), Some(x) => x.clone(),
}; };