#140 allow non-ASCII characters in downloaded zip filename

This commit is contained in:
Alan Grainger
2025-10-10 16:27:33 +08:00
parent 1191fa84ea
commit 18bf03239f
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -171,8 +171,9 @@ class Render {
*/
async downloadAll (res: Response, share: SharedLink) {
res.setHeader('Content-Type', 'application/zip')
const title = (sanitize(this.title(share)) || 'photos') + '.zip'
res.setHeader('Content-Disposition', `attachment; filename="${title}"`)
let filename = (sanitize(this.title(share)) || 'photos') + '.zip'
filename = encodeURI(filename)
res.setHeader('Content-Disposition', `attachment; filename*=UTF-8''${filename}`)
const archive = archiver('zip', { zlib: { level: 6 } })
archive.pipe(res)
for (const asset of share.assets) {