diff --git a/src/file.js b/src/file.js index 6be1cd37c8..b9fe29881a 100644 --- a/src/file.js +++ b/src/file.js @@ -46,10 +46,6 @@ file.isFileTypeAllowed = function(path, allowedExtensions, callback) { return callback(); } - allowedExtensions = allowedExtensions.filter(Boolean).map(function(extension) { - return extension.trim(); - }); - var magic = new Magic(mmmagic.MAGIC_MIME_TYPE); magic.detectFile(path, function(err, mimeType) { if (err) { @@ -72,6 +68,14 @@ file.allowedExtensions = function() { return []; } allowedExtensions = allowedExtensions.split(','); + allowedExtensions = allowedExtensions.filter(Boolean).map(function(extension) { + extension = extension.trim(); + return extension.replace(/\./g, ''); + }); + if (allowedExtensions.indexOf('jpg') !== -1 && allowedExtensions.indexOf('jpeg') === -1) { + allowedExtensions.push('jpeg'); + } + console.log(allowedExtensions) return allowedExtensions; }; diff --git a/src/views/admin/settings/post.tpl b/src/views/admin/settings/post.tpl index b669021204..833b98fd6f 100644 --- a/src/views/admin/settings/post.tpl +++ b/src/views/admin/settings/post.tpl @@ -140,7 +140,7 @@ Topic Thumb Size

- Allowed file types, (ie png, pdf, zip). Leave empty to allow all.

+ Allowed file types, (ie png, jpg, pdf, zip). Leave empty to allow all.