allow non-standards fallback for all http.TimeFormats (#15662)

fixes #15645
This commit is contained in:
Harshavardhana
2022-09-07 07:24:54 -07:00
committed by GitHub
parent 52861d3aea
commit 228c6686f8
8 changed files with 153 additions and 52 deletions
+4 -6
View File
@@ -38,6 +38,7 @@ import (
"time"
"github.com/djherbis/atime"
"github.com/minio/minio/internal/amztime"
"github.com/minio/minio/internal/config/cache"
"github.com/minio/minio/internal/crypto"
"github.com/minio/minio/internal/disk"
@@ -132,17 +133,14 @@ func (m *cacheMeta) ToObjectInfo() (o ObjectInfo) {
} else {
o.StorageClass = globalMinioDefaultStorageClass
}
var (
t time.Time
e error
)
if exp, ok := meta["expires"]; ok {
if t, e = time.Parse(http.TimeFormat, exp); e == nil {
if t, e := amztime.ParseHeader(exp); e == nil {
o.Expires = t.UTC()
}
}
if mtime, ok := meta["last-modified"]; ok {
if t, e = time.Parse(http.TimeFormat, mtime); e == nil {
if t, e := amztime.ParseHeader(mtime); e == nil {
o.ModTime = t.UTC()
}
}