@@ -215,7 +215,7 @@ module.exports = (crowi: Crowi) => {
const { meta } = pageWithMeta;
// not found or forbidden
- if (page == null && (pages == null || pages.length === 0)) {
+ if (isIPageNotFoundInfo(meta) || (Array.isArray(pages) && pages.length === 0)) {
if (isIPageNotFoundInfo(meta) && meta.isForbidden) {
return res.apiv3Err(new ErrorV3('Page is forbidden', 'page-is-forbidden', undefined, meta), 403);
}
@@ -86,6 +86,7 @@ export type IPageHasId = IPage & HasObjectId;
export type IPageNotFoundInfo = {
isNotFound: true;
isForbidden: boolean;
+ isEmpty?: true;
};
export type IPageInfo = {
@@ -132,8 +133,7 @@ export const isIPageNotFoundInfo = (
return (
pageInfo != null &&
pageInfo instanceof Object &&
- pageInfo.isNotFound === true &&
- !('isEmpty' in pageInfo)
+ pageInfo.isNotFound === true
);