fix: #3432 Add Access-Control-Expose-Headers: Content-Disposition header in ServeFileDownload (#3433)

This commit is contained in:
wohenbushuang
2024-03-28 20:07:56 +08:00
committed by GitHub
parent 8669512f42
commit 3a9e0e34ca

View File

@ -90,6 +90,7 @@ func (r *Response) ServeFileDownload(path string, name ...string) {
r.Header().Set("Content-Type", "application/force-download")
r.Header().Set("Accept-Ranges", "bytes")
r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename=%s`, url.QueryEscape(downloadName)))
r.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
r.Server.serveFile(r.Request, serveFile)
}