Просмотр исходного кода

Throw 400 if pagepath is undefined

arvid-e 2 месяцев назад
Родитель
Сommit
efb23f58e2
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      packages/remark-lsx/src/server/routes/list-pages/index.ts

+ 4 - 0
packages/remark-lsx/src/server/routes/list-pages/index.ts

@@ -77,6 +77,10 @@ export const listPages = ({ excludedPaths }: { excludedPaths: string[] }) => {
 
     const { pagePath, offset, limit, options } = params;
 
+    if (pagePath == null || pagePath === '') {
+      return res.status(400).send("the 'pagepath' query must not be null.");
+    }
+
     // count viewers of `/`
     let toppageViewersCount: number;
     try {