diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-11-25 09:56:20 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-25 09:56:20 -0800 |
| commit | f6a604c538c0afa3caec55f8f717a784878e064b (patch) | |
| tree | 35c2226e98e9eb721a0b8c95d2fd9deab3059b1a /weed/s3api/s3api_acl_helper_test.go | |
| parent | a24c31de06093337cd31e42ed94de67ce1d5c95b (diff) | |
| download | seaweedfs-f6a604c538c0afa3caec55f8f717a784878e064b.tar.xz seaweedfs-f6a604c538c0afa3caec55f8f717a784878e064b.zip | |
S3: Fix encrypted file copy with multiple chunks (#7530) (#7546)
* S3: Fix encrypted file copy with multiple chunks (#7530)
When copying encrypted files with multiple chunks (encrypted volumes via
-filer.encryptVolumeData), the copied file could not be read. This was
caused by the chunk copy operation not preserving the IsCompressed flag,
which led to improper handling of compressed/encrypted data during upload.
The fix:
1. Modified uploadChunkData to accept an isCompressed parameter
2. Updated copySingleChunk to pass the source chunk's IsCompressed flag
3. Updated copySingleChunkForRange for partial copy operations
4. Updated all other callers to pass the appropriate compression flag
5. Added comprehensive tests for encrypted volume copy scenarios
This ensures that when copying chunks:
- The IsCompressed flag from the source chunk is passed to the upload
- Compressed data is marked as compressed, preventing double-compression
- Already-encrypted data is not re-encrypted (Cipher: false is correct)
- All chunk metadata (CipherKey, IsCompressed, ETag) is preserved
Tests added:
- TestCreateDestinationChunkPreservesEncryption: Verifies metadata preservation
- TestCopySingleChunkWithEncryption: Tests various encryption/compression scenarios
- TestCopyChunksPreservesMetadata: Tests multi-chunk metadata preservation
- TestEncryptedVolumeScenario: Documents and tests the exact issue #7530 scenario
Fixes #7530
* Address PR review feedback: simplify tests and improve clarity
- Removed TestUploadChunkDataCompressionFlag (panic-based test)
- Removed TestCopySingleChunkWithEncryption (duplicate coverage)
- Removed TestCopyChunksPreservesMetadata (duplicate coverage)
- Added ETag verification to TestEncryptedVolumeCopyScenario
- Renamed to TestEncryptedVolumeCopyScenario for better clarity
- All test coverage now in TestCreateDestinationChunkPreservesEncryption
and TestEncryptedVolumeCopyScenario which focus on the actual behavior
Diffstat (limited to 'weed/s3api/s3api_acl_helper_test.go')
0 files changed, 0 insertions, 0 deletions
