gtx-cli 2.1.4 → 2.1.5

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,11 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#576](https://github.com/generaltranslation/gt/pull/576) [`be9c1ff`](https://github.com/generaltranslation/gt/commit/be9c1ff24c9a15a35e3f0da26e9ec941e5b41eea) Thanks [@SamEggert](https://github.com/SamEggert)! - Fix url localization
8
+
3
9
  ## 2.1.4
4
10
 
5
11
  ### Patch Changes
@@ -76,6 +76,10 @@ export default async function localizeStaticUrls(settings) {
76
76
  * Determines if a URL should be processed based on pattern matching
77
77
  */
78
78
  function shouldProcessUrl(originalUrl, patternHead, targetLocale, defaultLocale) {
79
+ // Skip absolute URLs (http://, https://, //, etc.)
80
+ if (originalUrl.includes(':')) {
81
+ return false;
82
+ }
79
83
  const patternWithoutSlash = patternHead.replace(/\/$/, '');
80
84
  if (targetLocale === defaultLocale) {
81
85
  // For default locale processing, check if URL contains the pattern
@@ -145,7 +149,7 @@ function transformNonDefaultLocaleUrlWithHidden(originalUrl, patternHead, target
145
149
  return `${patternHead.replace(/\/$/, '')}/${targetLocale}`;
146
150
  }
147
151
  // Add target locale to URL without any locale
148
- const pathAfterHead = originalUrl.slice(patternHead.length);
152
+ const pathAfterHead = originalUrl.slice(originalUrl.startsWith(patternHead) ? patternHead.length : 0);
149
153
  return pathAfterHead
150
154
  ? `${patternHead}${targetLocale}/${pathAfterHead}`
151
155
  : `${patternHead}${targetLocale}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [