[#137] Add index page support
All checks were successful
/ DCO (pull_request) Successful in 53s
/ Vulncheck (pull_request) Successful in 1m29s
/ Builds (pull_request) Successful in 1m43s
/ Lint (pull_request) Successful in 2m57s
/ Tests (pull_request) Successful in 1m16s

Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
Nikita Zinkevich 2024-09-26 17:32:27 +03:00
parent 77eb474581
commit 8fe8f2dcc2
20 changed files with 738 additions and 80 deletions

View file

@ -53,6 +53,7 @@ func (h *Handler) receiveFile(ctx context.Context, req request, objectAddress oi
dis = "inline"
start = time.Now()
filename string
filepath string
)
prm := PrmObjectGet{
@ -104,6 +105,8 @@ func (h *Handler) receiveFile(ctx context.Context, req request, objectAddress oi
time.Unix(value, 0).UTC().Format(http.TimeFormat))
case object.AttributeContentType:
contentType = val
case object.AttributeFilePath:
filepath = val
}
}
@ -135,6 +138,10 @@ func (h *Handler) receiveFile(ctx context.Context, req request, objectAddress oi
}
req.SetContentType(contentType)
if filename == "" {
filename = filepath
}
req.Response.Header.Set(fasthttp.HeaderContentDisposition, dis+"; filename="+path.Base(filename))
req.Response.SetBodyStream(rObj.Payload, int(payloadSize))