forked from TrueCloudLab/frostfs-s3-gw
[#577] Add Version() to ExtendedObjectInfo
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
parent
3ac3f1cc9d
commit
37c46e926e
9 changed files with 27 additions and 22 deletions
|
@ -71,14 +71,15 @@ func overrideResponseHeaders(h http.Header, query url.Values) {
|
|||
}
|
||||
}
|
||||
|
||||
func writeHeaders(h http.Header, info *data.ObjectInfo, tagSetLength int) {
|
||||
func writeHeaders(h http.Header, extendedInfo *data.ExtendedObjectInfo, tagSetLength int) {
|
||||
info := extendedInfo.ObjectInfo
|
||||
if len(info.ContentType) > 0 && h.Get(api.ContentType) == "" {
|
||||
h.Set(api.ContentType, info.ContentType)
|
||||
}
|
||||
h.Set(api.LastModified, info.Created.UTC().Format(http.TimeFormat))
|
||||
h.Set(api.ContentLength, strconv.FormatInt(info.Size, 10))
|
||||
h.Set(api.ETag, info.HashSum)
|
||||
h.Set(api.AmzVersionID, info.ID.EncodeToString())
|
||||
h.Set(api.AmzVersionID, extendedInfo.Version())
|
||||
h.Set(api.AmzTaggingCount, strconv.Itoa(tagSetLength))
|
||||
|
||||
if cacheControl := info.Headers[api.CacheControl]; cacheControl != "" {
|
||||
|
@ -159,7 +160,7 @@ func (h *handler) GetObjectHandler(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
writeHeaders(w.Header(), info, len(tagSet))
|
||||
writeHeaders(w.Header(), extendedInfo, len(tagSet))
|
||||
if params != nil {
|
||||
writeRangeHeaders(w, params, info.Size)
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue