Skip to content

Commit

Permalink
Only allow routes without workspace prefix if you are in non-plugin m…
Browse files Browse the repository at this point in the history
…ode (#1786)
  • Loading branch information
jespino committed Nov 10, 2021
1 parent 67c7cb8 commit bb92550
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions webapp/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,31 +218,32 @@ const App = React.memo((): JSX.Element => {
<WelcomePage/>
</Route>

<Route
path='/:boardId?/:viewId?/:cardId?'
render={({match: {params: {boardId, viewId, cardId}}}) => {
// Since these 3 path values are optional and they can be anything, we can pass /x/y/z and it will
// match this route however these values may not be valid so we should at the very least check
// board id for descisions made below
const boardIdIsValidUUIDV4 = UUID_REGEX.test(boardId || '')
{!Utils.isFocalboardPlugin() &&
<Route
path='/:boardId?/:viewId?/:cardId?'
render={({match: {params: {boardId, viewId, cardId}}}) => {
// Since these 3 path values are optional and they can be anything, we can pass /x/y/z and it will
// match this route however these values may not be valid so we should at the very least check
// board id for descisions made below
const boardIdIsValidUUIDV4 = UUID_REGEX.test(boardId || '')

if (loggedIn === false) {
return <Redirect to='/login'/>
}
if (loggedIn === false) {
return <Redirect to='/login'/>
}

if (continueToWelcomeScreen()) {
const originalPath = `/${Utils.buildOriginalPath('', boardId, viewId, cardId)}`
const queryString = boardIdIsValidUUIDV4 ? `r=${originalPath}` : ''
return <Redirect to={`/welcome?${queryString}`}/>
}
if (continueToWelcomeScreen()) {
const originalPath = `/${Utils.buildOriginalPath('', boardId, viewId, cardId)}`
const queryString = boardIdIsValidUUIDV4 ? `r=${originalPath}` : ''
return <Redirect to={`/welcome?${queryString}`}/>
}

if (loggedIn === true) {
return <BoardPage/>
}
if (loggedIn === true) {
return <BoardPage/>
}

return null
}}
/>
return null
}}
/>}
</Switch>
</div>
</div>
Expand Down

0 comments on commit bb92550

Please sign in to comment.