Skip to content

Commit

Permalink
fix: added new logic
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabhsircar11 committed Jan 29, 2025
1 parent d35f17d commit 1fa651c
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions libs/blocks/locui-create/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,9 @@ export function validateOrigin(urlStr) {
if (SLD === 'hlx') {
return url.origin === origin;
}
const urlDomains = url.host?.split('.');
const originUrl = new URL(origin);
const originDomains = originUrl.host?.split('.');
if (SLD === 'aem' && urlDomains?.length === originDomains.length) {
const [urlSD, urlSLD] = urlDomains;
const [originSD] = originDomains;
if (urlSD === originSD && (urlSLD === 'aem' || urlSLD === 'hlx')) {
return true;
}
return false;
if (SLD === 'aem') {
const origins = [url.origin.replace('.aem.', '.hlx.'), url.origin.replace('.hlx.', '.aem.')];
return origins.includes(origin);
}
return false;
} catch {
Expand Down

0 comments on commit 1fa651c

Please sign in to comment.