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
This commit is contained in:
Miguel de la Cruz 2021-10-06 18:57:52 +02:00 committed by GitHub
parent ee3f00858a
commit 85ccc051ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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