mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
added client side checks on how long project or entity names can be
150 chars should be safely under the 1024 bytes mongo index limit
This commit is contained in:
parent
b05c6bb001
commit
28b1e6bfe5
3 changed files with 10 additions and 6 deletions
|
@ -272,9 +272,10 @@ define [
|
|||
|
||||
renameEntity: (entity, name, callback = (error) ->) ->
|
||||
return if entity.name == name
|
||||
entity.name = name
|
||||
if name.length < 150
|
||||
entity.name = name
|
||||
return @ide.$http.post "/project/#{@ide.project_id}/#{entity.type}/#{entity.id}/rename", {
|
||||
name: name,
|
||||
name: entity.name,
|
||||
_csrf: window.csrfToken
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,10 @@ define [
|
|||
$scope.$emit "project:rename:start"
|
||||
|
||||
$scope.finishRenaming = () ->
|
||||
$scope.project.name = $scope.inputs.name
|
||||
settings.saveProjectSettings({name: $scope.inputs.name})
|
||||
newName = $scope.inputs.name
|
||||
if newName.length < 150
|
||||
$scope.project.name = newName
|
||||
settings.saveProjectSettings({name: $scope.project.name})
|
||||
$scope.state.renaming = false
|
||||
|
||||
ide.socket.on "projectNameUpdated", (name) ->
|
||||
|
|
|
@ -257,9 +257,10 @@ define [
|
|||
window.location = "/project/#{project_id}"
|
||||
|
||||
$scope.renameProject = (project, newName) ->
|
||||
project.name = newName
|
||||
if newName.length < 150
|
||||
project.name = newName
|
||||
queuedHttp.post "/project/#{project.id}/rename", {
|
||||
newProjectName: newName
|
||||
newProjectName: project.name
|
||||
_csrf: window.csrfToken
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue