Browse Source

fix: encode filenames for assets force download

pull/5144/head
NGPixel 2 years ago
parent
commit
05b4053954
No known key found for this signature in database GPG Key ID: 8FDA2F1757F60D63
1 changed files with 1 additions and 1 deletions
  1. 2
      server/models/assets.js

2
server/models/assets.js

@ -174,7 +174,7 @@ module.exports = class Asset extends Model {
// Force unsafe extensions to download
if (WIKI.config.uploads.forceDownload && !['.png', '.apng', '.jpg', '.jpeg', '.gif', '.bmp', '.webp', '.svg'].includes(fileInfo.ext)) {
res.set('Content-disposition', 'attachment; filename=' + fileInfo.base)
res.set('Content-disposition', 'attachment; filename=' + encodeURIComponent(fileInfo.base))
}
if (await WIKI.models.assets.getAssetFromCache(assetPath, cachePath, res)) {

Loading…
Cancel
Save