Extract common function 'stripEndingSlash'

This commit is contained in:
René Pfeuffer
2020-09-18 17:20:54 +02:00
parent b1c0ec15a7
commit 4523e22feb
11 changed files with 27 additions and 83 deletions

View File

@@ -56,6 +56,7 @@ import SourceExtensions from "../sources/containers/SourceExtensions";
import { FileControlFactory, JumpToFileButton } from "@scm-manager/ui-components";
import TagsOverview from "../tags/container/TagsOverview";
import TagRoot from "../tags/container/TagRoot";
import { urls } from "@scm-manager/ui-components";
type Props = RouteComponentProps &
WithTranslation & {
@@ -84,15 +85,8 @@ class RepositoryRoot extends React.Component<Props> {
}
}
stripEndingSlash = (url: string) => {
if (url.endsWith("/")) {
return url.substring(0, url.length - 1);
}
return url;
};
matchedUrl = () => {
return this.stripEndingSlash(this.props.match.url);
return urls.stripEndingSlash(this.props.match.url);
};
matchesBranches = (route: any) => {