mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 00:26:53 +00:00
fix(s3): return InvalidArgument for mismatched ListMultipartUploads key-marker (#5914)
A key-marker that does not start with the request prefix is invalid input, not an unimplemented feature. Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -2355,7 +2355,7 @@ mod tests {
|
||||
let req = build_request(input, Method::GET);
|
||||
|
||||
let err = make_usecase().execute_list_multipart_uploads(req).await.unwrap_err();
|
||||
assert_eq!(err.code(), &S3ErrorCode::NotImplemented);
|
||||
assert_eq!(err.code(), &S3ErrorCode::InvalidArgument);
|
||||
assert_eq!(err.message(), Some("Invalid key marker"));
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ pub(crate) fn parse_list_multipart_uploads_params(
|
||||
if let Some(key_marker) = &key_marker
|
||||
&& !key_marker.starts_with(prefix.as_str())
|
||||
{
|
||||
return Err(S3Error::with_message(S3ErrorCode::NotImplemented, "Invalid key marker".to_string()));
|
||||
return Err(S3Error::with_message(S3ErrorCode::InvalidArgument, "Invalid key marker".to_string()));
|
||||
}
|
||||
|
||||
Ok(ListMultipartUploadsParams {
|
||||
@@ -390,7 +390,7 @@ mod tests {
|
||||
let err = parse_list_multipart_uploads_params(Some("prefix/".to_string()), Some("other/key-marker".to_string()), None)
|
||||
.expect_err("expected invalid key marker");
|
||||
|
||||
assert_eq!(*err.code(), S3ErrorCode::NotImplemented);
|
||||
assert_eq!(*err.code(), S3ErrorCode::InvalidArgument);
|
||||
assert_eq!(err.message(), Some("Invalid key marker"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user