mirror of
https://github.com/minio/minio.git
synced 2025-11-23 02:57:42 -05:00
convert ETag properly for all gateways (#5099)
Previously ID/ETag from backend service is used as is which causes failure on s3cmd like tools where those tools use ETag as checksum to validate data. This is fixed by prepending "-1". Refer minio/mint#193 minio/mint#201
This commit is contained in:
@@ -162,11 +162,6 @@ func azurePropertiesToS3Meta(meta storage.BlobMetadata, props storage.BlobProper
|
||||
return s3Metadata
|
||||
}
|
||||
|
||||
// Append "-1" to etag so that clients do not interpret it as MD5.
|
||||
func azureToS3ETag(etag string) string {
|
||||
return canonicalizeETag(etag) + "-1"
|
||||
}
|
||||
|
||||
// azureObjects - Implements Object layer for Azure blob storage.
|
||||
type azureObjects struct {
|
||||
gatewayUnsupported
|
||||
@@ -420,7 +415,7 @@ func (a *azureObjects) ListObjects(bucket, prefix, marker, delimiter string, max
|
||||
Name: object.Name,
|
||||
ModTime: time.Time(object.Properties.LastModified),
|
||||
Size: object.Properties.ContentLength,
|
||||
ETag: azureToS3ETag(object.Properties.Etag),
|
||||
ETag: toS3ETag(object.Properties.Etag),
|
||||
ContentType: object.Properties.ContentType,
|
||||
ContentEncoding: object.Properties.ContentEncoding,
|
||||
})
|
||||
@@ -510,7 +505,7 @@ func (a *azureObjects) GetObjectInfo(bucket, object string) (objInfo ObjectInfo,
|
||||
objInfo = ObjectInfo{
|
||||
Bucket: bucket,
|
||||
UserDefined: meta,
|
||||
ETag: azureToS3ETag(blob.Properties.Etag),
|
||||
ETag: toS3ETag(blob.Properties.Etag),
|
||||
ModTime: time.Time(blob.Properties.LastModified),
|
||||
Name: object,
|
||||
Size: blob.Properties.ContentLength,
|
||||
@@ -629,8 +624,7 @@ func (a *azureObjects) PutObjectPart(bucket, object, uploadID string, partID int
|
||||
|
||||
etag := data.MD5HexString()
|
||||
if etag == "" {
|
||||
// Generate random ETag.
|
||||
etag = azureToS3ETag(getMD5Hash([]byte(mustGetUUID())))
|
||||
etag = genETag()
|
||||
}
|
||||
|
||||
subPartSize, subPartNumber := int64(azureBlockSize), 1
|
||||
|
||||
Reference in New Issue
Block a user