Implement 404 for documents

This commit is contained in:
Jori Lallo
2016-08-03 15:36:50 +03:00
parent 80edf4a693
commit 5b3ed8b1f9
2 changed files with 8 additions and 2 deletions

View File

@@ -22,6 +22,8 @@ router.post('documents.info', auth({ require: false }), async (ctx) => {
},
});
if (!document) throw httpErrors.NotFound();
// Don't expose private documents outside the team
if (document.private) {
if (!ctx.state.user) throw httpErrors.NotFound();
@@ -39,8 +41,6 @@ router.post('documents.info', auth({ require: false }), async (ctx) => {
data: await presentDocument(document),
};
}
if (!document) throw httpErrors.NotFound();
});
router.post('documents.search', auth(), async (ctx) => {