mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add error handling in mkdir_p
This commit is contained in:
parent
ae5467894b
commit
4d0fe3bf5d
1 changed files with 3 additions and 0 deletions
|
@ -242,6 +242,7 @@ module.exports = ProjectEntityHandler =
|
||||||
return folder.length != 0
|
return folder.length != 0
|
||||||
|
|
||||||
ProjectGetter.getProjectWithOnlyFolders project_id, (err, project)=>
|
ProjectGetter.getProjectWithOnlyFolders project_id, (err, project)=>
|
||||||
|
return callback(err) if err?
|
||||||
if path == '/'
|
if path == '/'
|
||||||
logger.log project_id: project._id, "mkdir is only trying to make path of / so sending back root folder"
|
logger.log project_id: project._id, "mkdir is only trying to make path of / so sending back root folder"
|
||||||
return callback(null, [], project.rootFolder[0])
|
return callback(null, [], project.rootFolder[0])
|
||||||
|
@ -255,9 +256,11 @@ module.exports = ProjectEntityHandler =
|
||||||
parentFolder_id = parentFolder._id
|
parentFolder_id = parentFolder._id
|
||||||
builtUpPath = "#{builtUpPath}/#{folderName}"
|
builtUpPath = "#{builtUpPath}/#{folderName}"
|
||||||
projectLocator.findElementByPath project, builtUpPath, (err, foundFolder)=>
|
projectLocator.findElementByPath project, builtUpPath, (err, foundFolder)=>
|
||||||
|
return callback(err) if err?
|
||||||
if !foundFolder?
|
if !foundFolder?
|
||||||
logger.log path:path, project_id:project._id, folderName:folderName, "making folder from mkdirp"
|
logger.log path:path, project_id:project._id, folderName:folderName, "making folder from mkdirp"
|
||||||
@addFolder project_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)->
|
@addFolder project_id, parentFolder_id, folderName, (err, newFolder, parentFolder_id)->
|
||||||
|
return callback(err) if err?
|
||||||
newFolder.parentFolder_id = parentFolder_id
|
newFolder.parentFolder_id = parentFolder_id
|
||||||
previousFolders.push newFolder
|
previousFolders.push newFolder
|
||||||
callback null, previousFolders
|
callback null, previousFolders
|
||||||
|
|
Loading…
Reference in a new issue