Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-157540: fix external modals #2806

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/blocks/merch/merch.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export async function openModal(e, url, offerType) {
if (/\/fragments\//.test(url)) {
const fragmentPath = url.split(/hlx.(page|live)/).pop();
modal = await openFragmentModal(fragmentPath, getModal);
} else if (/^https?:/.test(url)) {
Copy link
Contributor

@npeltier npeltier Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rather try /^(https:/)?\// ? this way it's either https (original requirement) or relative path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can, but what is the point of such validation?
if author will put an invalid URL with or without validation the modal will just not show up, so I am not sure what it brings

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok if we neither wants https://... URLs i'm fine thought relative paths were an option

} else {
modal = await openExternalModal(url, getModal);
}
if (modal) {
Expand Down
Loading