diff options
| author | Pitu <[email protected]> | 2017-03-18 01:36:50 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2017-03-18 01:36:50 -0300 |
| commit | 026e0a3ef04efd97fda225391d6a72b7567f755d (patch) | |
| tree | f2ca18f829dee604c4ae7672909f6d293bfcaaea /controllers/uploadController.js | |
| parent | Added ShareX config instructions (diff) | |
| download | host.fuwn.me-026e0a3ef04efd97fda225391d6a72b7567f755d.tar.xz host.fuwn.me-026e0a3ef04efd97fda225391d6a72b7567f755d.zip | |
Derps were made, and now fixed
Diffstat (limited to 'controllers/uploadController.js')
| -rw-r--r-- | controllers/uploadController.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/controllers/uploadController.js b/controllers/uploadController.js index acbf440..39a9364 100644 --- a/controllers/uploadController.js +++ b/controllers/uploadController.js @@ -1,5 +1,5 @@ -const path = require('path') const config = require('../config.js') +const path = require('path') const multer = require('multer') const randomstring = require('randomstring') const db = require('knex')(config.database) @@ -151,7 +151,11 @@ uploadsController.processFilesForDisplay = function(req, res, files, existingFil }) for (let file of files) { - utils.generateThumbs(file) + let ext = path.extname(file.name).toLowerCase() + if (utils.extensions.includes(ext)) { + file.thumb = basedomain + '/thumbs/' + file.name.slice(0, -ext.length) + '.png' + utils.generateThumbs(file) + } } }).catch(function(error) { console.log(error); res.json({ success: false, description: 'error' }) }) @@ -260,7 +264,11 @@ uploadsController.list = function(req, res) { if (file.userid !== undefined && file.userid !== null && file.userid !== '') userids.push(file.userid) - utils.generateThumbs(file) + let ext = path.extname(file.name).toLowerCase() + if (utils.extensions.includes(ext)) { + file.thumb = basedomain + '/thumbs/' + file.name.slice(0, -ext.length) + '.png' + utils.generateThumbs(file) + } } // If we are a normal user, send response |