This commit is contained in:
chrislu
2025-07-18 16:25:45 -07:00
parent 2ad4a924be
commit a0ab227e07
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -214,7 +214,9 @@ func (s3a *S3ApiServer) isVersioningEnabled(bucket string) (bool, error) {
return false, fmt.Errorf("failed to get bucket config: %v", errCode)
}
return config.Versioning == "Enabled", nil
// Versioning is enabled if explicitly set to "Enabled" OR if object lock is enabled
// (since object lock requires versioning to be enabled)
return config.Versioning == s3_constants.VersioningEnabled || config.ObjectLockConfig != nil, nil
}
// getBucketVersioningStatus returns the versioning status for a bucket
+9
View File
@@ -599,6 +599,15 @@ func (s3a *S3ApiServer) checkGovernanceBypassPermission(request *http.Request, b
// checkObjectLockPermissions checks if an object can be deleted or modified
func (s3a *S3ApiServer) checkObjectLockPermissions(request *http.Request, bucket, object, versionId string, bypassGovernance bool) error {
// For delete operations without versionId (which create delete markers),
// we should allow the operation even if the object is under retention.
// This is because delete markers are logical deletes, not physical deletes.
// Only block deletions when a specific versionId is provided.
if versionId == "" {
// This is a delete marker creation - allow it
return nil
}
// Get the object entry once to check both retention and legal hold
entry, err := s3a.getObjectEntry(bucket, object, versionId)
if err != nil {