Skip to content

Commit

Permalink
fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
miya committed Sep 11, 2024
1 parent 12f7061 commit e7a94cb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions apps/app/src/server/routes/apiv3/page/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,9 @@ module.exports = (crowi) => {
pageId, path, findAll, revisionId, shareLinkId,
} = req.query;

if (isSharedPage && path != null) {
return res.apiv3Err(new ErrorV3('Either parameter of (pageId or path) or (pageId and shareLinkId) is required.', 'invalid-request'));
}

if (!isSharedPage && (pageId == null && path == null)) {
return res.apiv3Err(new ErrorV3('Either parameter of (pageId or path) or (pageId and shareLinkId) is required.', 'invalid-request'));
const isValid = (shareLinkId != null && pageId != null && path == null) || (shareLinkId == null && (pageId != null || path != null));
if (!isValid) {
return res.apiv3Err(new Error('Either parameter of (pageId or path) or (pageId and shareLinkId) is required.'), 400);
}

let page;
Expand Down

0 comments on commit e7a94cb

Please sign in to comment.