Skip to content

Commit 840b6cb

Browse files
committed
feat(serverHandler): add legacy filename attribute to Content-Disposition
1 parent df5fb4c commit 840b6cb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/serverHandler/archive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func writeArchiveHeader(w http.ResponseWriter, contentType, filename string) {
176176

177177
header := w.Header()
178178
header.Set("Content-Type", contentType)
179-
header.Set("Content-Disposition", "attachment; filename*=UTF-8''"+filename)
179+
header.Set("Content-Disposition", "attachment; filename="+filename+"; filename*=UTF-8''"+filename)
180180
header.Set("Cache-Control", "public, max-age=0")
181181
w.WriteHeader(http.StatusOK)
182182
}

src/serverHandler/content.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ func (h *aliasHandler) content(w http.ResponseWriter, r *http.Request, session *
1010
header.Set("Vary", session.vary)
1111
header.Set("X-Content-Type-Options", "nosniff")
1212
if data.IsDownload {
13-
header.Set("Content-Disposition", "attachment; filename*=UTF-8''"+url.PathEscape(data.ItemName))
13+
filename := url.PathEscape(data.ItemName)
14+
header.Set("Content-Disposition", "attachment; filename="+filename+"; filename*=UTF-8''"+filename)
1415
}
1516

1617
item := data.Item

0 commit comments

Comments
 (0)