From 05e835b9f129e74e4bca5040ef29200388c0242c Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Thu, 7 Oct 2021 09:21:00 +0200 Subject: [PATCH] catalog-import: replace trailing slash regexp with trimEnd Signed-off-by: Johan Haals --- .changeset/purple-dodos-glow.md | 1 + .../PreviewCatalogInfoComponent.tsx | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.changeset/purple-dodos-glow.md b/.changeset/purple-dodos-glow.md index 4c21866af6..23030c686c 100644 --- a/.changeset/purple-dodos-glow.md +++ b/.changeset/purple-dodos-glow.md @@ -4,6 +4,7 @@ '@backstage/integration': patch '@backstage/plugin-catalog-backend-module-ldap': patch '@backstage/plugin-catalog-backend-module-msgraph': patch +'@backstage/plugin-catalog-import': patch --- Replace slash stripping regexp with trimEnd to remove CodeQL warning diff --git a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx index 0327b7e792..d0f29c00e2 100644 --- a/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx +++ b/plugins/catalog-import/src/components/StepPrepareCreatePullRequest/PreviewCatalogInfoComponent.tsx @@ -19,6 +19,7 @@ import { Card, CardContent, CardHeader } from '@material-ui/core'; import React from 'react'; import YAML from 'yaml'; import { CodeSnippet } from '@backstage/core-components'; +import { trimEnd } from 'lodash'; type Props = { repositoryUrl: string; @@ -35,10 +36,7 @@ export const PreviewCatalogInfoComponent = ({ {`${repositoryUrl.replace( - /[\/]*$/, - '', - )}/catalog-info.yaml`} + {`${trimEnd(repositoryUrl, '/')}/catalog-info.yaml`} } />