From 767816e669ca896b112e3d0cb86d96a7fb6293ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 19 Feb 2015 16:46:00 -0500 Subject: [PATCH] #2738 --- src/controllers/uploads.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/uploads.js b/src/controllers/uploads.js index 58ab3689c1..79ae6fae19 100644 --- a/src/controllers/uploads.js +++ b/src/controllers/uploads.js @@ -119,8 +119,9 @@ function uploadFile(uid, uploadedFile, callback) { return callback(new Error('[[error:file-too-big, ' + meta.config.maximumFileSize + ']]')); } - var filename = uploadFile.name || 'upload'; - filename = validator.escape(filename).substr(0, 255) + '-' + Date.now(); + var filename = uploadedFile.name || 'upload'; + + filename = Date.now() + '-' + validator.escape(filename).substr(0, 255); file.saveFileToLocal(filename, 'files', uploadedFile.path, function(err, upload) { if (err) { return callback(err);