mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-25 01:14:50 +00:00
Update weed/s3api/object_lock_utils.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -217,15 +217,15 @@ func ValidateObjectLockParameters(enabled bool, mode string, duration int32) err
|
||||
}
|
||||
|
||||
if mode != s3_constants.RetentionModeGovernance && mode != s3_constants.RetentionModeCompliance {
|
||||
return fmt.Errorf("invalid object lock mode: %s, must be %s or %s", mode, s3_constants.RetentionModeGovernance, s3_constants.RetentionModeCompliance)
|
||||
return createS3Error("InvalidObjectLockMode", fmt.Sprintf("Invalid object lock mode: %s. Must be %s or %s.", mode, s3_constants.RetentionModeGovernance, s3_constants.RetentionModeCompliance))
|
||||
}
|
||||
|
||||
if duration <= 0 {
|
||||
return fmt.Errorf("object lock duration must be greater than 0 days, got: %d", duration)
|
||||
return createS3Error("InvalidObjectLockDuration", fmt.Sprintf("Object lock duration must be greater than 0 days. Got: %d.", duration))
|
||||
}
|
||||
|
||||
if duration > MaxRetentionDays {
|
||||
return fmt.Errorf("object lock duration exceeds maximum allowed days: %d, got: %d", MaxRetentionDays, duration)
|
||||
return createS3Error("ObjectLockDurationExceeded", fmt.Sprintf("Object lock duration exceeds maximum allowed days: %d. Got: %d.", MaxRetentionDays, duration))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user