Skip to content

Commit

Permalink
feat(serverHandler): add legacy filename attribute to `Content-Disp…
Browse files Browse the repository at this point in the history
…osition`
  • Loading branch information
marjune163 committed Oct 13, 2024
1 parent df5fb4c commit 840b6cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/serverHandler/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func writeArchiveHeader(w http.ResponseWriter, contentType, filename string) {

header := w.Header()
header.Set("Content-Type", contentType)
header.Set("Content-Disposition", "attachment; filename*=UTF-8''"+filename)
header.Set("Content-Disposition", "attachment; filename="+filename+"; filename*=UTF-8''"+filename)
header.Set("Cache-Control", "public, max-age=0")
w.WriteHeader(http.StatusOK)
}
Expand Down
3 changes: 2 additions & 1 deletion src/serverHandler/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ func (h *aliasHandler) content(w http.ResponseWriter, r *http.Request, session *
header.Set("Vary", session.vary)
header.Set("X-Content-Type-Options", "nosniff")
if data.IsDownload {
header.Set("Content-Disposition", "attachment; filename*=UTF-8''"+url.PathEscape(data.ItemName))
filename := url.PathEscape(data.ItemName)
header.Set("Content-Disposition", "attachment; filename="+filename+"; filename*=UTF-8''"+filename)
}

item := data.Item
Expand Down

0 comments on commit 840b6cb

Please sign in to comment.