Browse Source

add error mapping

pull/6997/head
chrislu 5 months ago
parent
commit
40d9f4fa9c
  1. 16
      weed/s3api/s3api_object_handlers_put.go

16
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

Loading…
Cancel
Save