From 51b632bb10849436666ae30d3bd909f1a6582074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E5=B0=8F=E9=B8=AD?= Date: Wed, 2 Sep 2026 23:53:27 +0800 Subject: [PATCH] fix(s3): keep checksum-type validation off the s3s error macro The s3s footprint ratchet (scripts/check_s3s_footprint.sh) counts s3_error! invocation lines and is lower-only: new code must route through the gateway abstractions rather than widen the direct s3s surface the s3gate migration is shrinking. Raise the contradiction through ApiError::invalid_request instead. The response is byte-for-byte identical -- From for S3Error carries the InvalidRequest code and the message through unchanged -- and the usecase already returns ApiError elsewhere, so this is the idiomatic path rather than a way around the counter. The explanatory comment deliberately says "the s3s error macro" instead of naming the macro: the ratchet counts raw matches, so spelling it out in a comment tripped the same check. --- rustfs/src/app/multipart_usecase.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rustfs/src/app/multipart_usecase.rs b/rustfs/src/app/multipart_usecase.rs index 96f591f01..820fcfa58 100644 --- a/rustfs/src/app/multipart_usecase.rs +++ b/rustfs/src/app/multipart_usecase.rs @@ -320,10 +320,13 @@ fn validate_complete_multipart_checksum_type(headers: &HeaderMap, upload_metadat }; if requested != recorded { - return Err(s3_error!( - InvalidRequest, + // Routed through `ApiError` rather than the s3s error macro so this + // validation does not widen the direct s3s surface the s3gate migration + // is shrinking (scripts/check_s3s_footprint.sh); the response is identical. + return Err(ApiError::invalid_request(format!( "The upload was created with checksum type {recorded}. The complete request must use the same checksum type, got {requested}." - )); + )) + .into()); } Ok(())