mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
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:
parent
3ab57f6830
commit
4f0b922a5d
2 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -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", ->
|
||||
|
|
Loading…
Reference in a new issue