forked from TrueCloudLab/frostfs-s3-gw
[#331] Use UTC Last-Modified time
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
7488bd3e7e
commit
a46726a545
5 changed files with 8 additions and 8 deletions
|
@ -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 {
|
if info, err = h.obj.CopyObject(r.Context(), params); err != nil {
|
||||||
h.logAndSendError(w, "couldn't copy object", reqInfo, err, additional...)
|
h.logAndSendError(w, "couldn't copy object", reqInfo, err, additional...)
|
||||||
return
|
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...)
|
h.logAndSendError(w, "something went wrong", reqInfo, err, additional...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (h *handler) ListBucketsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
for _, item := range list {
|
for _, item := range list {
|
||||||
res.Buckets.Buckets = append(res.Buckets.Buckets, Bucket{
|
res.Buckets.Buckets = append(res.Buckets.Buckets, Bucket{
|
||||||
Name: item.Name,
|
Name: item.Name,
|
||||||
CreationDate: item.Created.Format(time.RFC3339),
|
CreationDate: item.Created.UTC().Format(time.RFC3339),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@ func (h *handler) UploadPartCopy(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
response := UploadPartCopyResponse{
|
response := UploadPartCopyResponse{
|
||||||
ETag: info.HashSum,
|
ETag: info.HashSum,
|
||||||
LastModified: info.Created.Format(time.RFC3339),
|
LastModified: info.Created.UTC().Format(time.RFC3339),
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = api.EncodeToResponse(w, response); err != nil {
|
if err = api.EncodeToResponse(w, response); err != nil {
|
||||||
|
@ -636,7 +636,7 @@ func encodeListMultipartUploadsToResponse(info *layer.ListMultipartUploadsInfo,
|
||||||
uploads := make([]MultipartUpload, 0, len(info.Uploads))
|
uploads := make([]MultipartUpload, 0, len(info.Uploads))
|
||||||
for _, u := range info.Uploads {
|
for _, u := range info.Uploads {
|
||||||
m := MultipartUpload{
|
m := MultipartUpload{
|
||||||
Initiated: u.Created.Format(time.RFC3339),
|
Initiated: u.Created.UTC().Format(time.RFC3339),
|
||||||
Initiator: Initiator{
|
Initiator: Initiator{
|
||||||
ID: u.Owner.String(),
|
ID: u.Owner.String(),
|
||||||
DisplayName: u.Owner.String(),
|
DisplayName: u.Owner.String(),
|
||||||
|
|
|
@ -194,7 +194,7 @@ func fillContents(src []*data.ObjectInfo, encode string, fetchOwner bool) []Obje
|
||||||
res := Object{
|
res := Object{
|
||||||
Key: s3PathEncode(obj.Name, encode),
|
Key: s3PathEncode(obj.Name, encode),
|
||||||
Size: obj.Size,
|
Size: obj.Size,
|
||||||
LastModified: obj.Created.Format(time.RFC3339),
|
LastModified: obj.Created.UTC().Format(time.RFC3339),
|
||||||
ETag: obj.HashSum,
|
ETag: obj.HashSum,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ func encodeListObjectVersionsToResponse(info *layer.ListObjectVersionsInfo, buck
|
||||||
res.Version = append(res.Version, ObjectVersionResponse{
|
res.Version = append(res.Version, ObjectVersionResponse{
|
||||||
IsLatest: ver.IsLatest,
|
IsLatest: ver.IsLatest,
|
||||||
Key: ver.Object.Name,
|
Key: ver.Object.Name,
|
||||||
LastModified: ver.Object.Created.Format(time.RFC3339),
|
LastModified: ver.Object.Created.UTC().Format(time.RFC3339),
|
||||||
Owner: Owner{
|
Owner: Owner{
|
||||||
ID: ver.Object.Owner.String(),
|
ID: ver.Object.Owner.String(),
|
||||||
DisplayName: 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{
|
res.DeleteMarker = append(res.DeleteMarker, DeleteMarkerEntry{
|
||||||
IsLatest: del.IsLatest,
|
IsLatest: del.IsLatest,
|
||||||
Key: del.Object.Name,
|
Key: del.Object.Name,
|
||||||
LastModified: del.Object.Created.Format(time.RFC3339),
|
LastModified: del.Object.Created.UTC().Format(time.RFC3339),
|
||||||
Owner: Owner{
|
Owner: Owner{
|
||||||
ID: del.Object.Owner.String(),
|
ID: del.Object.Owner.String(),
|
||||||
DisplayName: del.Object.Owner.String(),
|
DisplayName: del.Object.Owner.String(),
|
||||||
|
|
|
@ -404,7 +404,7 @@ func (n *layer) ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsIn
|
||||||
}
|
}
|
||||||
parts = append(parts, &Part{
|
parts = append(parts, &Part{
|
||||||
ETag: objInfo.HashSum,
|
ETag: objInfo.HashSum,
|
||||||
LastModified: objInfo.Created.Format(time.RFC3339),
|
LastModified: objInfo.Created.UTC().Format(time.RFC3339),
|
||||||
PartNumber: num,
|
PartNumber: num,
|
||||||
Size: objInfo.Size,
|
Size: objInfo.Size,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue