Skip to content

Commit

Permalink
fix: In space menu the link Node Type redirection ko if '/#/' is incl…
Browse files Browse the repository at this point in the history
…uded - EXO-70360 - Meeds-io/meeds#1815 (#3653)

Before this change, When the href attribute contains a "#" followed by a fragment identifier, the browser treats it as an anchor link and tries to navigate to that fragment within the current page, instead of navigating to a different URL
After this change, Handling the click and manually perform the
redirection
  • Loading branch information
GouadriaHanen committed Mar 29, 2024
1 parent 02a3294 commit 2831b4b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
v-for="nav in navigations"
:key="nav.id"
:value="nav.id"
:href="urlVerify(nav.uri)"
:target="nav?.target === 'SAME_TAB' && '_self' || '_blank'"
@click="openUrl(nav.uri, nav?.target)"
class="spaceNavigationTab">
{{ nav.label }}
</v-tab>
Expand Down Expand Up @@ -117,11 +116,14 @@ export default {
window.setTimeout(() => window.dispatchEvent(new Event('resize')), 200);
});
},
urlVerify(url) {
openUrl(url, target) {
target = target === 'SAME_TAB' && '_self' || '_blank' ;
if (!url.match(/^(https?:\/\/|javascript:|\/portal\/)/) && this.isValidUrl(url) ) {
url = `//${url}`;
} else if (url.match(/^(\/portal\/)/)) {
url = `${window.location.origin}${url}`;
}
return url ;
window.open(url, target);
},
isValidUrl(str) {
const pattern = new RegExp(
Expand Down

0 comments on commit 2831b4b

Please sign in to comment.