fix: Adds quotes for object Etags

This commit is contained in:
niksis02
2025-02-28 00:43:51 +04:00
parent 2dbbfb87cf
commit d13791f5ce
4 changed files with 6 additions and 7 deletions

View File

@@ -563,7 +563,7 @@ Pager:
break Pager
}
objects = append(objects, s3response.Object{
ETag: (*string)(v.Properties.ETag),
ETag: backend.GetPtrFromString(fmt.Sprintf("%q", *v.Properties.ETag)),
Key: v.Name,
LastModified: v.Properties.LastModified,
Size: v.Properties.ContentLength,
@@ -645,7 +645,7 @@ Pager:
break Pager
}
objects = append(objects, s3response.Object{
ETag: (*string)(v.Properties.ETag),
ETag: backend.GetPtrFromString(fmt.Sprintf("%q", *v.Properties.ETag)),
Key: v.Name,
LastModified: v.Properties.LastModified,
Size: v.Properties.ContentLength,

View File

@@ -152,8 +152,8 @@ func GetMultipartMD5(parts []types.CompletedPart) string {
for _, part := range parts {
partsEtagBytes = append(partsEtagBytes, getEtagBytes(*part.ETag)...)
}
s3MD5 := fmt.Sprintf("%s-%d", md5String(partsEtagBytes), len(parts))
return s3MD5
return fmt.Sprintf("\"%s-%d\"", md5String(partsEtagBytes), len(parts))
}
func getEtagBytes(etag string) []byte {

View File

@@ -2814,7 +2814,7 @@ func (p *Posix) PutObject(ctx context.Context, po *s3.PutObjectInput) (s3respons
}
dataSum := hash.Sum(nil)
etag := hex.EncodeToString(dataSum[:])
etag := fmt.Sprintf("\"%v\"", hex.EncodeToString(dataSum[:]))
// if the versioning is enabled, generate a new versionID for the object
var versionID string

View File

@@ -368,10 +368,9 @@ func putObjects(client *s3.Client, objs []string, bucket string) ([]types.Object
return nil, err
}
k := key
etag := strings.Trim(*res.ETag, `"`)
contents = append(contents, types.Object{
Key: &k,
ETag: &etag,
ETag: res.ETag,
StorageClass: types.ObjectStorageClassStandard,
Size: &size,
})