@backstage/integration 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @backstage/integration
2
2
 
3
+ ## 1.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - cf196443d8da: Additional fix for Gitiles auth links
8
+ - Updated dependencies
9
+ - @backstage/config@1.0.8
10
+ - @backstage/errors@1.2.1
11
+
12
+ ## 1.6.1
13
+
14
+ ### Patch Changes
15
+
16
+ - 842eb24ef5e8: Gitiles: Fixed auth prefix issue
17
+ - Updated dependencies
18
+ - @backstage/config@1.0.8
19
+ - @backstage/errors@1.2.1
20
+
3
21
  ## 1.6.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.cjs.js CHANGED
@@ -1037,10 +1037,23 @@ function getAuthenticationPrefix(config) {
1037
1037
  return config.password ? "/a/" : "/";
1038
1038
  }
1039
1039
  function getGitilesAuthenticationUrl(config) {
1040
- const parsedUrl = new URL(config.gitilesBaseUrl);
1041
- return `${parsedUrl.protocol}//${parsedUrl.host}${getAuthenticationPrefix(
1042
- config
1043
- )}${parsedUrl.pathname.substring(1)}`;
1040
+ if (!config.baseUrl || !config.gitilesBaseUrl) {
1041
+ throw new Error(
1042
+ "Unexpected Gerrit config values. baseUrl or gitilesBaseUrl not set."
1043
+ );
1044
+ }
1045
+ if (config.gitilesBaseUrl.startsWith(config.baseUrl)) {
1046
+ return config.gitilesBaseUrl.replace(
1047
+ config.baseUrl.concat("/"),
1048
+ config.baseUrl.concat(getAuthenticationPrefix(config))
1049
+ );
1050
+ }
1051
+ if (config.password) {
1052
+ throw new Error(
1053
+ "Since the baseUrl (Gerrit) is not part of the gitilesBaseUrl, an authentication URL could not be constructed."
1054
+ );
1055
+ }
1056
+ return config.gitilesBaseUrl;
1044
1057
  }
1045
1058
  function getGerritBranchApiUrl(config, url) {
1046
1059
  const { branch, project } = parseGerritGitilesUrl(config, url);