depot/nix/pkgs/seaweedfs/0001-s3-remember-compressed-chunks-when-finalizing-multip.patch

49 lines
1.6 KiB
Diff

From 624e2d79ce5a03bb60afd8e1293089dd61c60d52 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Sun, 20 Oct 2024 16:12:10 +0100
Subject: [PATCH 1/2] [s3] remember compressed chunks when finalizing multipart
uploads
Any compressed chunks will forget that they're compressed when the
multipart upload is finalized. This breaks content readback if e.g. the
chunks are encrypted, because the sizes won't match the expectation.
---
weed/s3api/filer_multipart.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go
index 43f982897..76d27f460 100644
--- a/weed/s3api/filer_multipart.go
+++ b/weed/s3api/filer_multipart.go
@@ -5,9 +5,6 @@ import (
"encoding/hex"
"encoding/xml"
"fmt"
- "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
- "github.com/seaweedfs/seaweedfs/weed/stats"
- "golang.org/x/exp/slices"
"math"
"path/filepath"
"sort"
@@ -15,6 +12,10 @@ import (
"strings"
"time"
+ "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
+ "github.com/seaweedfs/seaweedfs/weed/stats"
+ "golang.org/x/exp/slices"
+
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/google/uuid"
@@ -209,6 +210,7 @@ func (s3a *S3ApiServer) completeMultipartUpload(input *s3.CompleteMultipartUploa
ModifiedTsNs: chunk.ModifiedTsNs,
CipherKey: chunk.CipherKey,
ETag: chunk.ETag,
+ IsCompressed: chunk.IsCompressed,
}
finalParts = append(finalParts, p)
offset += int64(chunk.Size)
--
2.46.0