This commit is contained in:
chrislu 2022-11-13 23:01:58 -08:00
commit 7ac40ae3d4
3 changed files with 10 additions and 2 deletions

View file

@ -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) {

View file

@ -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)

View file

@ -285,7 +285,8 @@ func (s3a *S3ApiServer) generateUploadID(object string) string {
func (s3a *S3ApiServer) checkUploadId(object string, id string) error {
hash := s3a.generateUploadID(object)
if hash != id {
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)
}