Only allow routes without workspace prefix if you are in non-plugin mode (#1786)

This commit is contained in:
Jesús Espino 2021-11-10 18:18:02 +01:00 committed by GitHub
parent 3ede6df028
commit 537e015c72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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