From 180853a2c9355aaa415badb5b8300bff703452b1 Mon Sep 17 00:00:00 2001 From: aronneagu Date: Thu, 10 Nov 2022 15:09:53 +0000 Subject: [PATCH 1/3] Replace dashes with underscores in x-amz-meta headers (#3965) --- weed/remote_storage/azure/azure_storage_client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/remote_storage/azure/azure_storage_client.go b/weed/remote_storage/azure/azure_storage_client.go index af67c8565..8183c77a4 100644 --- a/weed/remote_storage/azure/azure_storage_client.go +++ b/weed/remote_storage/azure/azure_storage_client.go @@ -187,7 +187,11 @@ func toMetadata(attributes map[string][]byte) map[string]string { metadata[k[len(s3_constants.AmzUserMetaPrefix):]] = string(v) } } - return metadata + parsed_metadata := make(map[string]string) + for k, v := range metadata { + parsed_metadata[strings.Replace(k, "-", "_", -1)] = v + } + return parsed_metadata } func (az *azureRemoteStorageClient) UpdateFileMetadata(loc *remote_pb.RemoteStorageLocation, oldEntry *filer_pb.Entry, newEntry *filer_pb.Entry) (err error) { From df0662038c99a4d0c883464371272d1ab7ec19e6 Mon Sep 17 00:00:00 2001 From: famosss Date: Thu, 10 Nov 2022 23:17:29 +0800 Subject: [PATCH 2/3] feat:add a uuid after uploadid (#3963) --- weed/s3api/filer_multipart.go | 3 +++ weed/s3api/s3api_object_multipart_handlers.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/weed/s3api/filer_multipart.go b/weed/s3api/filer_multipart.go index 71b93a202..0167b5906 100644 --- a/weed/s3api/filer_multipart.go +++ b/weed/s3api/filer_multipart.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "encoding/xml" "fmt" + "github.com/google/uuid" "github.com/seaweedfs/seaweedfs/weed/s3api/s3err" "golang.org/x/exp/slices" "math" @@ -32,6 +33,8 @@ func (s3a *S3ApiServer) createMultipartUpload(input *s3.CreateMultipartUploadInp uploadIdString := s3a.generateUploadID(*input.Key) + uploadIdString = uploadIdString + "_" +strings.ReplaceAll(uuid.New().String(),"-","") + if err := s3a.mkdir(s3a.genUploadsFolder(*input.Bucket), uploadIdString, func(entry *filer_pb.Entry) { if entry.Extended == nil { entry.Extended = make(map[string][]byte) diff --git a/weed/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go index 96000310c..d30e65ad9 100644 --- a/weed/s3api/s3api_object_multipart_handlers.go +++ b/weed/s3api/s3api_object_multipart_handlers.go @@ -284,8 +284,9 @@ func (s3a *S3ApiServer) generateUploadID(object string) string { // Check object name and uploadID when processing multipart uploading func (s3a *S3ApiServer) checkUploadId(object string, id string) error { - hash := s3a.generateUploadID(object) - if hash != id { + hash := s3a.generateUploadID(strings.Split(object, "_")[0]) + + if !strings.HasPrefix(id, hash) { glog.Errorf("object %s and uploadID %s are not matched", object, id) return fmt.Errorf("object %s and uploadID %s are not matched", object, id) } From 39f0246deb8edd4ac44f6fe7eb4afe55c2d2d923 Mon Sep 17 00:00:00 2001 From: LHHDZ Date: Fri, 11 Nov 2022 20:53:53 +0800 Subject: [PATCH 3/3] fix 'NoSuchUpload' when upload part (#3968) --- weed/s3api/s3api_object_multipart_handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go index d30e65ad9..b08a1e797 100644 --- a/weed/s3api/s3api_object_multipart_handlers.go +++ b/weed/s3api/s3api_object_multipart_handlers.go @@ -284,7 +284,7 @@ func (s3a *S3ApiServer) generateUploadID(object string) string { // Check object name and uploadID when processing multipart uploading func (s3a *S3ApiServer) checkUploadId(object string, id string) error { - hash := s3a.generateUploadID(strings.Split(object, "_")[0]) + hash := s3a.generateUploadID(object) if !strings.HasPrefix(id, hash) { glog.Errorf("object %s and uploadID %s are not matched", object, id)