forked from TrueCloudLab/frostfs-http-gw
Use path.Base because hdr.Value can be something like /path/to/filename.ext
This commit is contained in:
parent
53244fcaf3
commit
1542a01924
1 changed files with 3 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -98,7 +99,8 @@ func (r *router) receiveFile(c echo.Context) error {
|
|||
c.Response().Header().Set("x-"+hdr.Key, hdr.Value)
|
||||
|
||||
if hdr.Key == object.FilenameHeader && download {
|
||||
c.Response().Header().Set("Content-Disposition", "attachment; filename="+hdr.Value)
|
||||
// NOTE: we use path.Base because hdr.Value can be something like `/path/to/filename.ext`
|
||||
c.Response().Header().Set("Content-Disposition", "attachment; filename="+path.Base(hdr.Value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue