mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
server rejects rename of entitys over 150 chars
This commit is contained in:
parent
b01b05e49b
commit
8789a4bde1
2 changed files with 16 additions and 0 deletions
|
@ -42,6 +42,8 @@ module.exports = EditorHttpController =
|
|||
entity_id = req.params.entity_id
|
||||
entity_type = req.params.entity_type
|
||||
name = req.body.name
|
||||
if name.length > 150
|
||||
return res.send 400
|
||||
EditorController.renameEntity project_id, entity_id, entity_type, name, (error) ->
|
||||
return next(error) if error?
|
||||
res.send 204
|
||||
|
|
|
@ -108,6 +108,20 @@ describe "EditorHttpController", ->
|
|||
it "should send back a success response", ->
|
||||
@res.send.calledWith(204).should.equal true
|
||||
|
||||
describe "renameEntity with long name", ->
|
||||
beforeEach ->
|
||||
@req.params =
|
||||
Project_id: @project_id
|
||||
entity_id: @entity_id = "entity-id-123"
|
||||
entity_type: @entity_type = "entity-type"
|
||||
@req.body =
|
||||
name: @name = "EDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOTEDMUBEEBKBXUUUZERMNSXFFWIBHGSDAWGMRIQWJBXGWSBVWSIKLFPRBYSJEKMFHTRZBHVKJSRGKTBHMJRXPHORFHAKRNPZGGYIOT"
|
||||
@EditorController.renameEntity = sinon.stub().callsArg(4)
|
||||
@EditorHttpController.renameEntity @req, @res
|
||||
|
||||
it "should send back a bad request status code", ->
|
||||
@res.send.calledWith(400).should.equal true
|
||||
|
||||
describe "moveEntity", ->
|
||||
beforeEach ->
|
||||
@req.params =
|
||||
|
|
Loading…
Reference in a new issue