Skip to content

Commit

Permalink
fix: Incomplete URL substring sanitization (binary-com#7597)
Browse files Browse the repository at this point in the history
  • Loading branch information
niloofar-deriv authored and sanjam-deriv committed Mar 13, 2023
1 parent ae46572 commit 7b310c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/shared/src/utils/url/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const urlForCurrentDomain = (href: string) => {
const url_object = new URL(href);
if (Object.keys(host_map).includes(url_object.hostname)) {
url_object.hostname = host_map[url_object.hostname as keyof typeof host_map];
} else if (url_object.hostname.indexOf(default_domain) !== -1) {
} else if (url_object.hostname.match(default_domain)) {
// to keep all non-Binary links unchanged, we use default domain for all Binary links in the codebase (javascript and templates)
url_object.hostname = url_object.hostname.replace(
new RegExp(`\\.${default_domain}`, 'i'),
Expand Down

0 comments on commit 7b310c2

Please sign in to comment.