From 85ccc051ec02422e35ee884f2064e9028cefdeda Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Wed, 6 Oct 2021 18:57:52 +0200 Subject: [PATCH] Adds a check to ensure that the URL view belongs to the board or redirects (#1468) * Adds a check to ensure that the URL view belongs to the board or redirects * Fix linter --- webapp/src/pages/boardPage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/src/pages/boardPage.tsx b/webapp/src/pages/boardPage.tsx index 348e52bc8..58adc05b3 100644 --- a/webapp/src/pages/boardPage.tsx +++ b/webapp/src/pages/boardPage.tsx @@ -110,7 +110,8 @@ const BoardPage = (props: Props): JSX.Element => { } Utils.log(`attachToBoard: ${boardId}`) - if (!viewId && boardViews.length > 0) { + const viewIsFromBoard = boardViews.some((view) => view.id === viewId) + if ((!viewId || !viewIsFromBoard) && boardViews.length > 0) { const newPath = generatePath(match.path, {...match.params, boardId, viewId: boardViews[0].id}) history.replace(newPath) return