Skip to content

Commit

Permalink
Merge pull request #15 from eea/develop
Browse files Browse the repository at this point in the history
fix: do not prefix on externalRoutes
  • Loading branch information
claudiaifrim committed Feb 12, 2024
2 parents de972bc + 770d663 commit 554b099
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [0.1.14](https://github.com/eea/volto-prefixpath/compare/0.1.13...0.1.14) - 8 February 2024
### [0.1.15](https://github.com/eea/volto-prefixpath/compare/0.1.14...0.1.15) - 12 February 2024

#### :hammer_and_wrench: Others
#### :bug: Bug Fixes

- fix: only prefix when externalRoutes [nileshgulia1 - [`80bad2a`](https://github.com/eea/volto-prefixpath/commit/80bad2aa8dfc5443d319b2aa8d092354d45257ce)]

### [0.1.14](https://github.com/eea/volto-prefixpath/compare/0.1.13...0.1.14) - 8 February 2024

- fix flattenToAppUrl [nileshgulia1 - [`b9f390e`](https://github.com/eea/volto-prefixpath/commit/b9f390e4e30cd7cb557b28c7c16e8997417b3973)]
### [0.1.13](https://github.com/eea/volto-prefixpath/compare/0.1.12...0.1.13) - 29 January 2024

### [0.1.12](https://github.com/eea/volto-prefixpath/compare/0.1.11...0.1.12) - 25 January 2024
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-prefixpath",
"version": "0.1.14",
"version": "0.1.15",
"description": "@eeacms/volto-prefixpath: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
11 changes: 10 additions & 1 deletion src/customizations/volto/helpers/Url/Url.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,16 @@ export function flattenToAppURL(url) {
.replace(settings.internalApiPath, '')
.replace(settings.apiPath, '')
.replace(settings.publicURL, '');
if (!adjustedUrl?.startsWith('#')) {
const internalURL =
adjustedUrl &&
(adjustedUrl.indexOf(settings.publicURL) !== -1 ||
(settings.internalApiPath &&
adjustedUrl.indexOf(settings.internalApiPath) !== -1) ||
adjustedUrl.indexOf(settings.apiPath) !== -1 ||
adjustedUrl.charAt(0) === '/' ||
adjustedUrl.charAt(0) === '.');
//using isInternalUrl method causes infinite loop with special externalRoutes defined in wise-marine #264955
if (internalURL && !adjustedUrl.startsWith('#')) {
if (prefix && adjustedUrl?.length && !adjustedUrl?.startsWith(prefix))
adjustedUrl = `${prefix}${adjustedUrl}`;
}
Expand Down

0 comments on commit 554b099

Please sign in to comment.