Skip to content

Commit

Permalink
using URL instead of regex
Browse files Browse the repository at this point in the history
  • Loading branch information
saragajic11 committed Jun 10, 2024
1 parent 6eeb3d5 commit 194e53f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion eds/components/PartnerCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ class NewsCard extends LitElement {
console.error('URL is null or undefined');
return '';
}
return window.location.host === 'partners.adobe.com' ? url : url.replace(/^(https?:\/\/)[^\/]+/, `${window.location.protocol}//${window.location.host}`);
if(window.location.host === 'partners.adobe.com') {
return url;
}
const newUrl = new URL(url);
newUrl.protocol = window.location.protocol;
newUrl.host = window.location.host;
return newUrl;
}

render() {
Expand Down

0 comments on commit 194e53f

Please sign in to comment.