Fixed regex so it only match urls that starts with lang
This commit is contained in:
@@ -23,7 +23,7 @@ const useCheckIfExternal = (bookingUrl: string) => {
|
|||||||
const bookingURL = new URL(bookingUrl)
|
const bookingURL = new URL(bookingUrl)
|
||||||
|
|
||||||
const hostsMatch = hostName === bookingURL.hostname
|
const hostsMatch = hostName === bookingURL.hostname
|
||||||
const langRouteRegex = /\/[a-zA-Z]{2}\//
|
const langRouteRegex = /^\/[a-zA-Z]{2}\//
|
||||||
|
|
||||||
setIsExternal(!hostsMatch || !langRouteRegex.test(bookingURL.pathname))
|
setIsExternal(!hostsMatch || !langRouteRegex.test(bookingURL.pathname))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user