Skip to content

Commit 5071d1d

Browse files
committed
fix empty doc root request
1 parent d24a63d commit 5071d1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controllers/documentRoots.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const find: RequestHandler<{ id: string }> = async (req, res, next) => {
1414

1515
export const findMany: RequestHandler<any, any, any, { ids: string[] }> = async (req, res, next) => {
1616
const ids = Array.isArray(req.query.ids) ? req.query.ids : [req.query.ids];
17-
if (ids.length === 0) {
17+
if (ids.length === 0 || !req.query.ids) {
1818
return res.json([]);
1919
}
2020
const documents = await DocumentRoot.findManyModels((req as any).user!.id, ids);
@@ -35,7 +35,7 @@ export const findManyFor: RequestHandler<
3535
throw new HTTP403Error('Not Authorized');
3636
}
3737
const ids = Array.isArray(req.query.ids) ? req.query.ids : [req.query.ids];
38-
if (ids.length === 0) {
38+
if (ids.length === 0 || !req.query.ids) {
3939
return res.json([]);
4040
}
4141
const documents = await DocumentRoot.findManyModels(req.params.id, ids, !!req.query.ignoreMissingRoots);

0 commit comments

Comments
 (0)