Fix #140 allow non-English characters in downloaded zip filename
This commit is contained in:
+2
-1
@@ -4,6 +4,7 @@ import { Asset, AssetType, ImageSize, IncomingShareRequest, SharedLink } from '.
|
||||
import { canDownload, getConfigOption } from './functions'
|
||||
import archiver from 'archiver'
|
||||
import { respondToInvalidRequest } from './invalidRequestHandler'
|
||||
import { sanitize } from './includes/sanitize'
|
||||
|
||||
class Render {
|
||||
lgConfig
|
||||
@@ -170,7 +171,7 @@ class Render {
|
||||
*/
|
||||
async downloadAll (res: Response, share: SharedLink) {
|
||||
res.setHeader('Content-Type', 'application/zip')
|
||||
const title = this.title(share).replace(/[^\w .-]/g, '') + '.zip'
|
||||
const title = sanitize(this.title(share)) + '.zip'
|
||||
res.setHeader('Content-Disposition', `attachment; filename="${title}"`)
|
||||
const archive = archiver('zip', { zlib: { level: 6 } })
|
||||
archive.pipe(res)
|
||||
|
||||
Reference in New Issue
Block a user