check that content exists before adding it to getAllDocs.

causing error which I think is blowing up the mongo driver elsewhere
This commit is contained in:
Henry Oswald 2015-02-18 21:25:53 +00:00
parent 766bfbf5ef
commit 21a01d94d4

View file

@ -48,12 +48,13 @@ module.exports = ProjectEntityHandler =
for folderPath, folder of folders for folderPath, folder of folders
for doc in folder.docs for doc in folder.docs
content = docContents[doc._id.toString()] content = docContents[doc._id.toString()]
docs[path.join(folderPath, doc.name)] = { if content?
_id: doc._id docs[path.join(folderPath, doc.name)] = {
name: doc.name _id: doc._id
lines: content.lines name: doc.name
rev: content.rev lines: content.lines
} rev: content.rev
}
logger.log count:_.keys(docs).length, project_id:project_id, "returning docs for project" logger.log count:_.keys(docs).length, project_id:project_id, "returning docs for project"
callback null, docs callback null, docs