Browse Source

fixes

pull/6997/head
chrislu 5 months ago
parent
commit
a0ab227e07
  1. 4
      weed/s3api/s3api_bucket_config.go
  2. 9
      weed/s3api/s3api_object_retention.go

4
weed/s3api/s3api_bucket_config.go

@ -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
weed/s3api/s3api_object_retention.go

@ -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 {

Loading…
Cancel
Save