Final fixes to document move

This commit is contained in:
Jori Lallo
2017-10-01 23:42:17 -07:00
parent 466f6a509b
commit ccec69d431
4 changed files with 125 additions and 98 deletions

View File

@ -264,7 +264,7 @@ router.post('documents.move', auth(), async ctx => {
// Set parent document
if (parentDocument) {
const parent = await Document.findById(parentDocument);
if (parent.atlasId !== document.atlasId)
if (!parent || parent.atlasId !== document.atlasId)
throw httpErrors.BadRequest(
'Invalid parentDocument (must be same collection)'
);