mirror of
https://github.com/minio/minio.git
synced 2025-04-20 18:44:21 -04:00
Azure:ETag returned by ListObjects to be consistent with GetObjectInfo (#7301)
This commit is contained in:
parent
87cf51d5ab
commit
8e1e701d35
@ -564,12 +564,35 @@ func (a *azureObjects) ListObjects(ctx context.Context, bucket, prefix, marker,
|
|||||||
// skip all the entries till we reach the marker.
|
// skip all the entries till we reach the marker.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Populate correct ETag's if possible, this code primarily exists
|
||||||
|
// because AWS S3 indicates that
|
||||||
|
//
|
||||||
|
// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html
|
||||||
|
//
|
||||||
|
// Objects created by the PUT Object, POST Object, or Copy operation,
|
||||||
|
// or through the AWS Management Console, and are encrypted by SSE-S3
|
||||||
|
// or plaintext, have ETags that are an MD5 digest of their object data.
|
||||||
|
//
|
||||||
|
// Some applications depend on this behavior refer https://github.com/minio/minio/issues/6550
|
||||||
|
// So we handle it here and make this consistent.
|
||||||
|
etag := minio.ToS3ETag(blob.Properties.Etag)
|
||||||
|
switch {
|
||||||
|
case blob.Properties.ContentMD5 != "":
|
||||||
|
b, err := base64.StdEncoding.DecodeString(blob.Properties.ContentMD5)
|
||||||
|
if err == nil {
|
||||||
|
etag = hex.EncodeToString(b)
|
||||||
|
}
|
||||||
|
case blob.Metadata["md5sum"] != "":
|
||||||
|
etag = blob.Metadata["md5sum"]
|
||||||
|
delete(blob.Metadata, "md5sum")
|
||||||
|
}
|
||||||
|
|
||||||
objects = append(objects, minio.ObjectInfo{
|
objects = append(objects, minio.ObjectInfo{
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
Name: blob.Name,
|
Name: blob.Name,
|
||||||
ModTime: time.Time(blob.Properties.LastModified),
|
ModTime: time.Time(blob.Properties.LastModified),
|
||||||
Size: blob.Properties.ContentLength,
|
Size: blob.Properties.ContentLength,
|
||||||
ETag: minio.ToS3ETag(blob.Properties.Etag),
|
ETag: etag,
|
||||||
ContentType: blob.Properties.ContentType,
|
ContentType: blob.Properties.ContentType,
|
||||||
ContentEncoding: blob.Properties.ContentEncoding,
|
ContentEncoding: blob.Properties.ContentEncoding,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user