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:
yanglongwei
2026-08-12 15:43:03 +08:00
committed by GitHub
parent 5aac224a97
commit 3ebb426abe
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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"));
}
+2 -2
View File
@@ -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"));
}