aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_object_multipart_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-07-01 19:12:11 -0700
committerChris Lu <chris.lu@gmail.com>2021-07-01 19:12:11 -0700
commitc6d4c16079875dfbe0d350b83fbacccaaa9c15db (patch)
tree9506102c739d60c813774d7a3bd348f73aa088e9 /weed/s3api/s3api_object_multipart_handlers.go
parent2420c60fc418638aef936ac3fae5f5b342e7cc42 (diff)
downloadseaweedfs-c6d4c16079875dfbe0d350b83fbacccaaa9c15db.tar.xz
seaweedfs-c6d4c16079875dfbe0d350b83fbacccaaa9c15db.zip
S3: add metadata with multipart upload
fix https://github.com/chrislusf/seaweedfs/issues/2173
Diffstat (limited to 'weed/s3api/s3api_object_multipart_handlers.go')
-rw-r--r--weed/s3api/s3api_object_multipart_handlers.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/weed/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go
index de3faaaaa..a4daea7a2 100644
--- a/weed/s3api/s3api_object_multipart_handlers.go
+++ b/weed/s3api/s3api_object_multipart_handlers.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
+ weed_server "github.com/chrislusf/seaweedfs/weed/server"
"net/http"
"net/url"
"strconv"
@@ -24,10 +25,18 @@ const (
func (s3a *S3ApiServer) NewMultipartUploadHandler(w http.ResponseWriter, r *http.Request) {
bucket, object := getBucketAndObject(r)
- response, errCode := s3a.createMultipartUpload(&s3.CreateMultipartUploadInput{
- Bucket: aws.String(bucket),
- Key: objectKey(aws.String(object)),
- })
+ createMultipartUploadInput := &s3.CreateMultipartUploadInput{
+ Bucket: aws.String(bucket),
+ Key: objectKey(aws.String(object)),
+ Metadata: make(map[string]*string),
+ }
+
+ metadata := weed_server.SaveAmzMetaData(r, nil, false)
+ for k, v := range metadata {
+ createMultipartUploadInput.Metadata[k] = aws.String(string(v))
+ }
+
+ response, errCode := s3a.createMultipartUpload(createMultipartUploadInput)
glog.V(2).Info("NewMultipartUploadHandler", s3err.EncodeXMLResponse(response), errCode)