Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-02 15:08:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-02 15:08:02 +0300
commitf62c9f693fbe0d9bfac43cbe24b86af3c35f6a17 (patch)
tree7bbeb4fdf92d78324a92ff8a1385ea807c78665a /app/assets/javascripts/vue_shared/components/source_viewer
parent81745c5a7143999d492943a2dceb977ced0a766f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/source_viewer')
-rw-r--r--app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/go_sum_linker.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/go_sum_linker.js b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/go_sum_linker.js
index c0e3eadb3b3..b290dfa78b9 100644
--- a/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/go_sum_linker.js
+++ b/app/assets/javascripts/vue_shared/components/source_viewer/plugins/utils/go_sum_linker.js
@@ -8,8 +8,8 @@ const GO_PACKAGE_URL = 'https://pkg.go.dev/';
const DEPENDENCY_REGEX = new RegExp(
/*
* Detects dependencies inside of content that is highlighted by Highlight.js
- * Example: '<span class="">cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=</span>'
- * Group 1 (packageName): 'cloud.google.com/go/bigquery'
+ * Example: '<span class="">cloud.google.com/Go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=</span>'
+ * Group 1 (packagePath): 'cloud.google.com/Go/bigquery'
* Group 2 (version): 'v1.0.1/go.mod'
* Group 3 (base64url): 'i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o='
*/
@@ -17,17 +17,18 @@ const DEPENDENCY_REGEX = new RegExp(
'gm',
);
-const handleReplace = (packageName, version, tag) => {
- const packageHref = `${GO_PACKAGE_URL}${packageName}`;
- const packageLink = createLink(packageHref, packageName);
- const tagHref = `${TAG_URL}${packageName}@${version.split('/go.mod')[0]}`;
+const handleReplace = (packagePath, version, tag) => {
+ const lowercasePath = packagePath.toLowerCase();
+ const packageHref = `${GO_PACKAGE_URL}${lowercasePath}`;
+ const packageLink = createLink(packageHref, packagePath);
+ const tagHref = `${TAG_URL}${lowercasePath}@${version.split('/go.mod')[0]}`;
const tagLink = createLink(tagHref, tag);
return `${openTag}${packageLink} ${version} h1:${tagLink}${closeTag}`;
};
export default (result) => {
- return result.value.replace(DEPENDENCY_REGEX, (_, packageName, version, tag) =>
- handleReplace(packageName, version, tag),
+ return result.value.replace(DEPENDENCY_REGEX, (_, packagePath, version, tag) =>
+ handleReplace(packagePath, version, tag),
);
};