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
This commit is contained in:
Henry Oswald 2015-06-30 16:37:21 +01:00
parent 3ab57f6830
commit 4f0b922a5d
2 changed files with 7 additions and 6 deletions

View file

@ -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

View file

@ -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", ->