From 4f0b922a5da04aefdbae2e9fdbb145a451858297 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 30 Jun 2015 16:37:21 +0100 Subject: [PATCH] changed name used when project or file uploaded, this changed when we started using https://github.com/expressjs/multer * originalname - Name of the file on the user's computer * name - Renamed file name --- .../coffee/Features/Uploads/ProjectUploadController.coffee | 7 ++++--- .../coffee/Uploads/ProjectUploadControllerTests.coffee | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/services/web/app/coffee/Features/Uploads/ProjectUploadController.coffee b/services/web/app/coffee/Features/Uploads/ProjectUploadController.coffee index 1fa00e3f01..83a8db5c2d 100644 --- a/services/web/app/coffee/Features/Uploads/ProjectUploadController.coffee +++ b/services/web/app/coffee/Features/Uploads/ProjectUploadController.coffee @@ -9,8 +9,8 @@ module.exports = ProjectUploadController = uploadProject: (req, res, next) -> timer = new metrics.Timer("project-upload") user_id = req.session.user._id - {name, path} = req.files.qqfile - name = Path.basename(name, ".zip") + {originalname, path} = req.files.qqfile + name = Path.basename(originalname, ".zip") ProjectUploadManager.createProjectFromZipArchive user_id, name, path, (error, project) -> fs.unlink path, -> timer.done() @@ -27,7 +27,8 @@ module.exports = ProjectUploadController = uploadFile: (req, res, next) -> timer = new metrics.Timer("file-upload") - {name, path} = req.files.qqfile + name = req.files.qqfile.originalname + path = req.files.qqfile.path project_id = req.params.Project_id folder_id = req.query.folder_id if !name? or name.length == 0 or name.length > 150 diff --git a/services/web/test/UnitTests/coffee/Uploads/ProjectUploadControllerTests.coffee b/services/web/test/UnitTests/coffee/Uploads/ProjectUploadControllerTests.coffee index 9ca0dccc30..dd4240d1b8 100644 --- a/services/web/test/UnitTests/coffee/Uploads/ProjectUploadControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Uploads/ProjectUploadControllerTests.coffee @@ -29,7 +29,7 @@ describe "ProjectUploadController", -> @req.files = qqfile: path: @path - name: @name + originalname: @name @req.session = user: _id: @user_id @@ -102,7 +102,7 @@ describe "ProjectUploadController", -> @req.files = qqfile: path: @path - name: @name + originalname: @name @req.params = Project_id: @project_id @req.query = @@ -173,7 +173,7 @@ describe "ProjectUploadController", -> describe "with a bad request", -> beforeEach -> - @req.files.qqfile.name = "" + @req.files.qqfile.originalname = "" @ProjectUploadController.uploadFile @req, @res it "should return a a non success response", ->