From 588761f948b317c914ebddb11ba333f90438e633 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 23 Jan 2020 04:26:21 +0100 Subject: [PATCH] ext --- app/Controllers/Http/DownloadController.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Http/DownloadController.js b/app/Controllers/Http/DownloadController.js index 5141136..3150dda 100644 --- a/app/Controllers/Http/DownloadController.js +++ b/app/Controllers/Http/DownloadController.js @@ -51,10 +51,10 @@ class DownloadController { for (let f of file) { if (f.endsWith('.mp4') || f.endsWith('.webm')) { // Send file name, file size in MB relative path for the file - files.push({ name: f, size: (fs.statSync(`./public/uploads/${f}`).size / 1000000.0).toFixed(2), location: `uploads/${f}`, img: '' }); + files.push({ name: f.split('.').slice(0, -1).join('.'), size: (fs.statSync(`./public/uploads/${f}`).size / 1000000.0).toFixed(2), location: `uploads/${f}`, ext: f.split('.').pop(), img: '' }); } else if (f.endsWith('.mp3') || f.endsWith('.flac')) { // Send file name, file size in MB relative path for the file and relative path of music.png - files.push({ name: f, size: (fs.statSync(`./public/uploads/${f}`).size / 1000000.0).toFixed(2), location: `uploads/${f}`, img: `/asset/music.png` }); + files.push({ name: f.split('.').slice(0, -1).join('.'), size: (fs.statSync(`./public/uploads/${f}`).size / 1000000.0).toFixed(2), location: `uploads/${f}`, ext: f.split('.').pop(), img: `/asset/music.png` }); } } return view.render('index', { title: title, viewCounter: viewCounter, file: files, day: day, month: month, announcement: announcement });