fix uploads with no extensions

v1.18.x
barisusakli 9 years ago
parent 2ce24f8ba9
commit 9b54ce7235

@ -185,6 +185,9 @@ function uploadFile(uid, uploadedFile, callback) {
if (meta.config.hasOwnProperty('allowedFileExtensions')) {
var allowed = file.allowedExtensions();
var extension = path.extname(uploadedFile.name);
if (!extension) {
extension = '.' + mime.extension(uploadedFile.type);
}
if (allowed.length > 0 && allowed.indexOf(extension) === -1) {
return callback(new Error('[[error:invalid-file-type, ' + allowed.join(', ') + ']]'));
}
@ -195,7 +198,7 @@ function uploadFile(uid, uploadedFile, callback) {
function saveFileToLocal(uploadedFile, callback) {
var extension = path.extname(uploadedFile.name);
if(!extension) {
if (!extension) {
extension = '.' + mime.extension(uploadedFile.type);
}

Loading…
Cancel
Save