Fix "cannot set headers after sent" in setting doc end point
If somehow a project ends up with the same doc/file in two locations in the file tree, then projectLocator.findElement will return the callback for both entries. This then tries to end the request multiple times. Of course this should never be a state the project is in, but if it is we should catch it.
This commit is contained in:
@@ -5,7 +5,11 @@ logger = require('logger-sharelatex')
|
||||
async = require('async')
|
||||
|
||||
module.exports =
|
||||
findElement: (options, callback = (err, element, path, parentFolder)->)->
|
||||
findElement: (options, _callback = (err, element, path, parentFolder)->)->
|
||||
callback = (args...) ->
|
||||
_callback(args...)
|
||||
_callback = () ->
|
||||
|
||||
{project, project_id, element_id, type} = options
|
||||
elementType = sanitizeTypeOfElement type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user