mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
Filter Expires header from user metadata (#7269)
Instead save it as a struct field in ObjectInfo as it is a standard HTTP header - Fixes minio/mc#2690
This commit is contained in:
@@ -797,12 +797,22 @@ func fromGCSAttrsToObjectInfo(attrs *storage.ObjectAttrs) minio.ObjectInfo {
|
||||
// All google cloud storage objects have a CRC32c hash, whereas composite objects may not have a MD5 hash
|
||||
// Refer https://cloud.google.com/storage/docs/hashes-etags. Use CRC32C for ETag
|
||||
metadata := make(map[string]string)
|
||||
var (
|
||||
expiry time.Time
|
||||
e error
|
||||
)
|
||||
for k, v := range attrs.Metadata {
|
||||
k = http.CanonicalHeaderKey(k)
|
||||
// Translate the GCS custom metadata prefix
|
||||
if strings.HasPrefix(k, "X-Goog-Meta-") {
|
||||
k = strings.Replace(k, "X-Goog-Meta-", "X-Amz-Meta-", 1)
|
||||
}
|
||||
if k == "Expires" {
|
||||
if expiry, e = time.Parse(http.TimeFormat, v); e == nil {
|
||||
expiry = expiry.UTC()
|
||||
}
|
||||
continue
|
||||
}
|
||||
metadata[k] = v
|
||||
}
|
||||
if attrs.ContentType != "" {
|
||||
@@ -829,6 +839,7 @@ func fromGCSAttrsToObjectInfo(attrs *storage.ObjectAttrs) minio.ObjectInfo {
|
||||
UserDefined: metadata,
|
||||
ContentType: attrs.ContentType,
|
||||
ContentEncoding: attrs.ContentEncoding,
|
||||
Expires: expiry,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user