mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #285 from sharelatex/file-path-checks
add file path check on element names
This commit is contained in:
commit
8492ea7d28
1 changed files with 5 additions and 0 deletions
|
@ -512,6 +512,11 @@ module.exports = ProjectEntityHandler =
|
|||
return callback(e)
|
||||
type = sanitizeTypeOfElement type
|
||||
|
||||
if path.resolve("/", element.name) isnt "/#{element.name}" or element.name.match("/")
|
||||
e = new Error("invalid element name")
|
||||
logger.err project_id:project._id, folder_id:folder_id, element:element, type:type, "failed trying to insert element as name was invalid"
|
||||
return callback(e)
|
||||
|
||||
if !folder_id?
|
||||
folder_id = project.rootFolder[0]._id
|
||||
ProjectEntityHandler._countElements project, (err, count)->
|
||||
|
|
Loading…
Reference in a new issue