Merge pull request #2482 from AreYouRlyScared/fix-2386

Remove trailing slash if one is present
This commit is contained in:
Dane Everitt 2020-10-12 20:14:05 -07:00 committed by GitHub
commit a967dbc6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { Route, RouteComponentProps, Switch } from 'react-router-dom'; import { Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import LoginContainer from '@/components/auth/LoginContainer'; import LoginContainer from '@/components/auth/LoginContainer';
import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer'; import ForgotPasswordContainer from '@/components/auth/ForgotPasswordContainer';
import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer'; import ResetPasswordContainer from '@/components/auth/ResetPasswordContainer';
@ -15,6 +15,7 @@ export default ({ location, history, match }: RouteComponentProps) => {
return ( return (
<div className={'pt-8 xl:pt-32'}> <div className={'pt-8 xl:pt-32'}>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={`${match.path}/login`} component={LoginContainer} exact/> <Route path={`${match.path}/login`} component={LoginContainer} exact/>
<Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/> <Route path={`${match.path}/login/checkpoint`} component={LoginCheckpointContainer}/>
<Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/> <Route path={`${match.path}/password`} component={ForgotPasswordContainer} exact/>

View File

@ -1,6 +1,6 @@
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer'; import AccountOverviewContainer from '@/components/dashboard/AccountOverviewContainer';
import NavigationBar from '@/components/NavigationBar'; import NavigationBar from '@/components/NavigationBar';
import DashboardContainer from '@/components/dashboard/DashboardContainer'; import DashboardContainer from '@/components/dashboard/DashboardContainer';
@ -27,6 +27,7 @@ export default ({ location }: RouteComponentProps) => {
} }
<TransitionRouter> <TransitionRouter>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={'/'} component={DashboardContainer} exact /> <Route path={'/'} component={DashboardContainer} exact />
<Route path={'/account'} component={AccountOverviewContainer} exact/> <Route path={'/account'} component={AccountOverviewContainer} exact/>
<Route path={'/account/api'} component={AccountApiContainer} exact/> <Route path={'/account/api'} component={AccountApiContainer} exact/>

View File

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import ReactGA from 'react-ga'; import ReactGA from 'react-ga';
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { NavLink, Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom';
import NavigationBar from '@/components/NavigationBar'; import NavigationBar from '@/components/NavigationBar';
import ServerConsole from '@/components/server/ServerConsole'; import ServerConsole from '@/components/server/ServerConsole';
import TransitionRouter from '@/TransitionRouter'; import TransitionRouter from '@/TransitionRouter';
@ -123,6 +123,7 @@ const ServerRouter = ({ match, location }: RouteComponentProps<{ id: string }>)
<> <>
<TransitionRouter> <TransitionRouter>
<Switch location={location}> <Switch location={location}>
<Redirect from="/:url*(/+)" to={location.pathname.slice(0, -1)} />
<Route path={`${match.path}`} component={ServerConsole} exact/> <Route path={`${match.path}`} component={ServerConsole} exact/>
<Route <Route
path={`${match.path}/files`} path={`${match.path}/files`}