mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add null checks for fileRefs and docs, which are not present when calling mkdirp
This commit is contained in:
parent
1a67e4982e
commit
c2e14ded13
1 changed files with 3 additions and 4 deletions
|
@ -101,16 +101,15 @@ module.exports = ProjectLocator =
|
|||
getEntity = (folder, entityName, cb)->
|
||||
if !entityName?
|
||||
return cb null, folder, "folder"
|
||||
|
||||
for file in folder.fileRefs
|
||||
for file in folder.fileRefs or []
|
||||
if file?.name.toLowerCase() == entityName.toLowerCase()
|
||||
result = file
|
||||
type = "file"
|
||||
for doc in folder.docs
|
||||
for doc in folder.docs or []
|
||||
if doc?.name.toLowerCase() == entityName.toLowerCase()
|
||||
result = doc
|
||||
type = "doc"
|
||||
for childFolder in folder.folders
|
||||
for childFolder in folder.folders or []
|
||||
if childFolder?.name.toLowerCase() == entityName.toLowerCase()
|
||||
result = childFolder
|
||||
type = "folder"
|
||||
|
|
Loading…
Reference in a new issue