#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
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "immich-public-proxy", "name": "immich-public-proxy",
"version": "1.13.3", "version": "1.13.4",
"scripts": { "scripts": {
"dev": "ts-node src/index.ts", "dev": "ts-node src/index.ts",
"build": "npx tsc", "build": "npx tsc",
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* From https://github.com/parshap/node-sanitize-filename * From https://www.npmjs.com/package/sanitize-filename
* *
* Replaces characters in strings that are illegal/unsafe for filenames. * Replaces characters in strings that are illegal/unsafe for filenames.
* Unsafe characters are either removed or replaced by a substitute set * Unsafe characters are either removed or replaced by a substitute set
+3 -2
View File
@@ -171,8 +171,9 @@ class Render {
*/ */
async downloadAll (res: Response, share: SharedLink) { async downloadAll (res: Response, share: SharedLink) {
res.setHeader('Content-Type', 'application/zip') res.setHeader('Content-Type', 'application/zip')
const title = (sanitize(this.title(share)) || 'photos') + '.zip' let filename = (sanitize(this.title(share)) || 'photos') + '.zip'
res.setHeader('Content-Disposition', `attachment; filename="${title}"`) filename = encodeURI(filename)
res.setHeader('Content-Disposition', `attachment; filename*=UTF-8''${filename}`)
const archive = archiver('zip', { zlib: { level: 6 } }) const archive = archiver('zip', { zlib: { level: 6 } })
archive.pipe(res) archive.pipe(res)
for (const asset of share.assets) { for (const asset of share.assets) {