[#331] Use UTC Last-Modified time

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-01-25 16:13:17 +03:00 committed by Angira Kekteeva
parent 7488bd3e7e
commit a46726a545
5 changed files with 8 additions and 8 deletions

View file

@ -111,7 +111,7 @@ func (h *handler) CopyObjectHandler(w http.ResponseWriter, r *http.Request) {
if info, err = h.obj.CopyObject(r.Context(), params); err != nil {
h.logAndSendError(w, "couldn't copy object", reqInfo, err, additional...)
return
} else if err = api.EncodeToResponse(w, &CopyObjectResponse{LastModified: info.Created.Format(time.RFC3339), ETag: info.HashSum}); err != nil {
} else if err = api.EncodeToResponse(w, &CopyObjectResponse{LastModified: info.Created.UTC().Format(time.RFC3339), ETag: info.HashSum}); err != nil {
h.logAndSendError(w, "something went wrong", reqInfo, err, additional...)
return
}

View file

@ -38,7 +38,7 @@ func (h *handler) ListBucketsHandler(w http.ResponseWriter, r *http.Request) {
for _, item := range list {
res.Buckets.Buckets = append(res.Buckets.Buckets, Bucket{
Name: item.Name,
CreationDate: item.Created.Format(time.RFC3339),
CreationDate: item.Created.UTC().Format(time.RFC3339),
})
}

View file

@ -342,7 +342,7 @@ func (h *handler) UploadPartCopy(w http.ResponseWriter, r *http.Request) {
response := UploadPartCopyResponse{
ETag: info.HashSum,
LastModified: info.Created.Format(time.RFC3339),
LastModified: info.Created.UTC().Format(time.RFC3339),
}
if err = api.EncodeToResponse(w, response); err != nil {
@ -636,7 +636,7 @@ func encodeListMultipartUploadsToResponse(info *layer.ListMultipartUploadsInfo,
uploads := make([]MultipartUpload, 0, len(info.Uploads))
for _, u := range info.Uploads {
m := MultipartUpload{
Initiated: u.Created.Format(time.RFC3339),
Initiated: u.Created.UTC().Format(time.RFC3339),
Initiator: Initiator{
ID: u.Owner.String(),
DisplayName: u.Owner.String(),

View file

@ -194,7 +194,7 @@ func fillContents(src []*data.ObjectInfo, encode string, fetchOwner bool) []Obje
res := Object{
Key: s3PathEncode(obj.Name, encode),
Size: obj.Size,
LastModified: obj.Created.Format(time.RFC3339),
LastModified: obj.Created.UTC().Format(time.RFC3339),
ETag: obj.HashSum,
}
@ -281,7 +281,7 @@ func encodeListObjectVersionsToResponse(info *layer.ListObjectVersionsInfo, buck
res.Version = append(res.Version, ObjectVersionResponse{
IsLatest: ver.IsLatest,
Key: ver.Object.Name,
LastModified: ver.Object.Created.Format(time.RFC3339),
LastModified: ver.Object.Created.UTC().Format(time.RFC3339),
Owner: Owner{
ID: ver.Object.Owner.String(),
DisplayName: ver.Object.Owner.String(),
@ -296,7 +296,7 @@ func encodeListObjectVersionsToResponse(info *layer.ListObjectVersionsInfo, buck
res.DeleteMarker = append(res.DeleteMarker, DeleteMarkerEntry{
IsLatest: del.IsLatest,
Key: del.Object.Name,
LastModified: del.Object.Created.Format(time.RFC3339),
LastModified: del.Object.Created.UTC().Format(time.RFC3339),
Owner: Owner{
ID: del.Object.Owner.String(),
DisplayName: del.Object.Owner.String(),

View file

@ -404,7 +404,7 @@ func (n *layer) ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsIn
}
parts = append(parts, &Part{
ETag: objInfo.HashSum,
LastModified: objInfo.Created.Format(time.RFC3339),
LastModified: objInfo.Created.UTC().Format(time.RFC3339),
PartNumber: num,
Size: objInfo.Size,
})