Sanitize Content-Disposition filename in downloads
Fixes #17 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fc2a3880c4
commit
ace0c06362
|
|
@ -2,6 +2,7 @@ package public
|
|||
|
||||
import (
|
||||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
|
@ -531,7 +532,7 @@ func (h *TicketHandler) proxyAssetDownload(c *gin.Context, assetURL, filename st
|
|||
contentType = "application/octet-stream"
|
||||
}
|
||||
c.Header("Content-Type", contentType)
|
||||
c.Header("Content-Disposition", "attachment; filename=\""+filename+"\"")
|
||||
c.Header("Content-Disposition", mime.FormatMediaType("attachment", map[string]string{"filename": filename}))
|
||||
if cl := resp.Header.Get("Content-Length"); cl != "" {
|
||||
c.Header("Content-Length", cl)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue