Skip to content

Commit

Permalink
fix: only prefix when externalRoutes
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Feb 12, 2024
1 parent 316afa5 commit 80bad2a
Showing 1 changed file with 10 additions and 1 deletion.
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 80bad2a

Please sign in to comment.