mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-06 16:17:01 +00:00
fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user