From 40d9f4fa9c7e0e75c8737fc782feedc15dfbe14b Mon Sep 17 00:00:00 2001 From: chrislu Date: Fri, 18 Jul 2025 17:08:59 -0700 Subject: [PATCH] add error mapping --- weed/s3api/s3api_object_handlers_put.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go index 79214d5ed..50067f85e 100644 --- a/weed/s3api/s3api_object_handlers_put.go +++ b/weed/s3api/s3api_object_handlers_put.go @@ -608,6 +608,22 @@ func mapValidationErrorToS3Error(err error) s3err.ErrorCode { // For invalid retention mode, return InvalidRequest // This matches the test expectations return s3err.ErrInvalidRequest + case errors.Is(err, ErrComplianceModeActive): + // For compliance mode retention violations, return AccessDenied + // This matches the test expectations + return s3err.ErrAccessDenied + case errors.Is(err, ErrGovernanceModeActive): + // For governance mode retention violations, return AccessDenied + // This matches the test expectations + return s3err.ErrAccessDenied + case errors.Is(err, ErrObjectUnderLegalHold): + // For legal hold violations, return AccessDenied + // This matches the test expectations + return s3err.ErrAccessDenied + case errors.Is(err, ErrGovernanceBypassNotPermitted): + // For governance bypass permission violations, return AccessDenied + // This matches the test expectations + return s3err.ErrAccessDenied // Validation error constants case errors.Is(err, ErrObjectLockConfigurationMissingEnabled): return s3err.ErrMalformedXML