This commit is contained in:
anatoly@nspcc.ru 2020-06-10 20:38:03 +03:00
parent 0e1fea52c6
commit 6b3344bd41

View file

@ -113,7 +113,7 @@ func (a *app) receiveFile(c *fasthttp.RequestCtx) {
func receiveObject(c *fasthttp.RequestCtx, cli object.Service_GetClient) error { func receiveObject(c *fasthttp.RequestCtx, cli object.Service_GetClient) error {
var ( var (
typ string typ string
content_disp_type string content_disp_type string = "inline"
put = c.Request.URI().QueryArgs().GetBool("download") put = c.Request.URI().QueryArgs().GetBool("download")
) )
@ -142,8 +142,6 @@ func receiveObject(c *fasthttp.RequestCtx, cli object.Service_GetClient) error {
if hdr.Key == object.FilenameHeader { if hdr.Key == object.FilenameHeader {
if put { if put {
content_disp_type = "attachment" content_disp_type = "attachment"
} else {
content_disp_type = "inline"
} }
// NOTE: we use path.Base because hdr.Value can be something like `/path/to/filename.ext` // NOTE: we use path.Base because hdr.Value can be something like `/path/to/filename.ext`
c.Response.Header.Set("Content-Disposition", content_disp_type+"; filename="+path.Base(hdr.Value)) c.Response.Header.Set("Content-Disposition", content_disp_type+"; filename="+path.Base(hdr.Value))