Browse Source

refactor: simplify isOrphanedSSES3Header function logic

Remove redundant existence check since the caller iterates through
metadata map, making the check unnecessary. Improves readability
while maintaining the same functionality.
pull/7568/head
Chris Lu 5 days ago
parent
commit
4851c6d62a
  1. 13
      weed/s3api/s3api_object_handlers_copy.go

13
weed/s3api/s3api_object_handlers_copy.go

@ -2367,14 +2367,13 @@ func isOrphanedSSES3Header(headerKey string, metadata map[string][]byte) bool {
return false
}
// Check if this is an AES256 (SSE-S3) header
if val, exists := metadata[s3_constants.AmzServerSideEncryption]; exists {
if string(val) == "AES256" {
// It's orphaned if the actual key is missing
_, hasKey := metadata[s3_constants.SeaweedFSSSES3Key]
return !hasKey
}
// The header is AmzServerSideEncryption. Check if its value indicates SSE-S3.
if string(metadata[headerKey]) == "AES256" {
// It's an SSE-S3 header. It's orphaned if the actual encryption key is missing.
_, hasKey := metadata[s3_constants.SeaweedFSSSES3Key]
return !hasKey
}
return false
}

Loading…
Cancel
Save