From b0d319f99b95b56302ab0ec6df07d97aaee544ea Mon Sep 17 00:00:00 2001 From: Rene Pfeuffer Date: Fri, 3 Nov 2023 15:48:10 +0100 Subject: [PATCH] Fix display for submodules without http MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pushed-by: Rene Pfeuffer Co-authored-by: René Pfeuffer Committed-by: René Pfeuffer --- gradle/changelog/submodule_without_http.yaml | 2 ++ .../src/repos/sources/components/content/FileLink.tsx | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 gradle/changelog/submodule_without_http.yaml diff --git a/gradle/changelog/submodule_without_http.yaml b/gradle/changelog/submodule_without_http.yaml new file mode 100644 index 0000000000..4c90813179 --- /dev/null +++ b/gradle/changelog/submodule_without_http.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Source view with submodules without http or https URL diff --git a/scm-ui/ui-webapp/src/repos/sources/components/content/FileLink.tsx b/scm-ui/ui-webapp/src/repos/sources/components/content/FileLink.tsx index e8fee16950..6b1eb124df 100644 --- a/scm-ui/ui-webapp/src/repos/sources/components/content/FileLink.tsx +++ b/scm-ui/ui-webapp/src/repos/sources/components/content/FileLink.tsx @@ -36,6 +36,9 @@ type Props = { }; const getHostname = (repositoryUrl: string) => { + if (!repositoryUrl.startsWith("http://") && !repositoryUrl.startsWith("https://")) { + return undefined; + } let host = repositoryUrl.split("/")[2]; if (host.includes("@")) { // remove prefix