mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
server rejects project names over 150 chars
This commit is contained in:
parent
28b1e6bfe5
commit
b01b05e49b
2 changed files with 9 additions and 0 deletions
|
@ -109,6 +109,8 @@ module.exports = ProjectController =
|
||||||
renameProject: (req, res)->
|
renameProject: (req, res)->
|
||||||
project_id = req.params.Project_id
|
project_id = req.params.Project_id
|
||||||
newName = req.body.newProjectName
|
newName = req.body.newProjectName
|
||||||
|
if newName.length > 150
|
||||||
|
return res.send 400
|
||||||
editorController.renameProject project_id, newName, (err)->
|
editorController.renameProject project_id, newName, (err)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, project_id:project_id, newName:newName, "problem renaming project"
|
logger.err err:err, project_id:project_id, newName:newName, "problem renaming project"
|
||||||
|
|
|
@ -252,6 +252,13 @@ describe "ProjectController", ->
|
||||||
done()
|
done()
|
||||||
@ProjectController.renameProject @req, @res
|
@ProjectController.renameProject @req, @res
|
||||||
|
|
||||||
|
it "should return an error if the name is over 150 chars", (done)->
|
||||||
|
@req.body.newProjectName = "EDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOTEDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOT"
|
||||||
|
@res.send = (code)=>
|
||||||
|
code.should.equal 400
|
||||||
|
done()
|
||||||
|
@ProjectController.renameProject @req, @res
|
||||||
|
|
||||||
describe "loadEditor", ->
|
describe "loadEditor", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@settings.editorIsOpen = true
|
@settings.editorIsOpen = true
|
||||||
|
|
Loading…
Reference in a new issue