Quote and escape Content-Disposition header

This commit is contained in:
Daniel Barton
2021-02-21 14:41:50 +08:00
parent 7541e769e0
commit 4ed0bf522b
3 changed files with 4 additions and 4 deletions

View File

@@ -102,7 +102,7 @@ func getServerArchive(c *gin.Context) {
c.Header("X-Checksum", checksum)
c.Header("X-Mime-Type", st.Mimetype)
c.Header("Content-Length", strconv.Itoa(int(st.Size())))
c.Header("Content-Disposition", "attachment; filename="+s.Archiver.Name())
c.Header("Content-Disposition", "attachment; filename="+strconv.Quote(s.Archiver.Name()))
c.Header("Content-Type", "application/octet-stream")
bufio.NewReader(file).WriteTo(c.Writer)