]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - src/files.js
Add file download button
[perso/Immae/Projets/Nodejs/Surfer.git] / src / files.js
index 876ff4e96798b938708cec8dfca372b8e39b56d5..1af4a18a3ece1f215342cd2b90fda8fa871d28ff 100644 (file)
@@ -88,7 +88,7 @@ function get(req, res, next) {
         debug('get', absoluteFilePath);
 
         if (!result.isDirectory() && !result.isFile()) return next(new HttpError(500, 'unsupported type'));
-        if (result.isFile()) return res.sendFile(absoluteFilePath);
+        if (result.isFile()) return res.download(absoluteFilePath);
 
         async.map(fs.readdirSync(absoluteFilePath), function (filePath, callback) {
             fs.stat(path.join(absoluteFilePath, filePath), function (error, result) {