allow non-standards fallback for Expires header (#15655)

fixes #15645
This commit is contained in:
Harshavardhana 2022-09-05 19:18:18 -07:00 committed by GitHub
parent 2d9b5a65f1
commit 7776d064cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,9 +132,13 @@ func (fi FileInfo) ToObjectInfo(bucket, object string, versioned bool) ObjectInf
t time.Time
e error
)
const nonStandardHTTPTimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT"
if exp, ok := fi.Metadata["expires"]; ok {
if t, e = time.Parse(http.TimeFormat, exp); e == nil {
objInfo.Expires = t.UTC()
} else if t, e = time.Parse(nonStandardHTTPTimeFormat, exp); e == nil {
objInfo.Expires = t.UTC()
}
}
objInfo.backendType = BackendErasure