Skip to content

Commit

Permalink
Fix bug avec certain nom de fichier qd on download
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-perso committed Sep 29, 2023
1 parent 19e0729 commit f74b510
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ fastify.get('/files/download', async (req, res) => {
console.log(`A user is downloading a file.. (shareKey: ${shareKey})`)
var fileSize = fs.statSync(path.join(storagePath, dbInfo.transferKey, 'file')).size
var stream = fs.createReadStream(path.join(storagePath, dbInfo.transferKey, 'file'))
res.header('Content-Disposition', `attachment; filename=${dbInfo.fileName}`)
res.header('Content-Disposition', `attachment; filename=${encodeURIComponent(dbInfo.fileName)}`)
res.header('Content-Length', fileSize)
return res.send(stream).type('application/octet-stream').code(200)
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "stend-api",
"version": "1.2.0",
"version": "1.2.1",
"description": "Télécharger et envoyer des fichiers via Stend",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f74b510

Please sign in to comment.