diff --git a/weed/s3api/s3api_object_handlers_copy.go b/weed/s3api/s3api_object_handlers_copy.go index 58b67e8d3..0c465d3db 100644 --- a/weed/s3api/s3api_object_handlers_copy.go +++ b/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 }