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) ->
|
uploadProject: (req, res, next) ->
|
||||||
timer = new metrics.Timer("project-upload")
|
timer = new metrics.Timer("project-upload")
|
||||||
user_id = req.session.user._id
|
user_id = req.session.user._id
|
||||||
{name, path} = req.files.qqfile
|
{originalname, path} = req.files.qqfile
|
||||||
name = Path.basename(name, ".zip")
|
name = Path.basename(originalname, ".zip")
|
||||||
ProjectUploadManager.createProjectFromZipArchive user_id, name, path, (error, project) ->
|
ProjectUploadManager.createProjectFromZipArchive user_id, name, path, (error, project) ->
|
||||||
fs.unlink path, ->
|
fs.unlink path, ->
|
||||||
timer.done()
|
timer.done()
|
||||||
|
@ -27,7 +27,8 @@ module.exports = ProjectUploadController =
|
||||||
|
|
||||||
uploadFile: (req, res, next) ->
|
uploadFile: (req, res, next) ->
|
||||||
timer = new metrics.Timer("file-upload")
|
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
|
project_id = req.params.Project_id
|
||||||
folder_id = req.query.folder_id
|
folder_id = req.query.folder_id
|
||||||
if !name? or name.length == 0 or name.length > 150
|
if !name? or name.length == 0 or name.length > 150
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe "ProjectUploadController", ->
|
||||||
@req.files =
|
@req.files =
|
||||||
qqfile:
|
qqfile:
|
||||||
path: @path
|
path: @path
|
||||||
name: @name
|
originalname: @name
|
||||||
@req.session =
|
@req.session =
|
||||||
user:
|
user:
|
||||||
_id: @user_id
|
_id: @user_id
|
||||||
|
@ -102,7 +102,7 @@ describe "ProjectUploadController", ->
|
||||||
@req.files =
|
@req.files =
|
||||||
qqfile:
|
qqfile:
|
||||||
path: @path
|
path: @path
|
||||||
name: @name
|
originalname: @name
|
||||||
@req.params =
|
@req.params =
|
||||||
Project_id: @project_id
|
Project_id: @project_id
|
||||||
@req.query =
|
@req.query =
|
||||||
|
@ -173,7 +173,7 @@ describe "ProjectUploadController", ->
|
||||||
describe "with a bad request", ->
|
describe "with a bad request", ->
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@req.files.qqfile.name = ""
|
@req.files.qqfile.originalname = ""
|
||||||
@ProjectUploadController.uploadFile @req, @res
|
@ProjectUploadController.uploadFile @req, @res
|
||||||
|
|
||||||
it "should return a a non success response", ->
|
it "should return a a non success response", ->
|
||||||
|
|
Loading…
Reference in a new issue