mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-23 17:10:07 +00:00
update: isUrlInWhitelist
This commit is contained in:
parent
e59a350090
commit
992fbd8229
@ -427,6 +427,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
|
|||||||
const target = props.target || null
|
const target = props.target || null
|
||||||
|
|
||||||
function isUrlInWhitelist (url: string, whitelist: string[] = []): boolean {
|
function isUrlInWhitelist (url: string, whitelist: string[] = []): boolean {
|
||||||
|
if (!whitelist.length) { return false }
|
||||||
try {
|
try {
|
||||||
const urlObj = new URL(url)
|
const urlObj = new URL(url)
|
||||||
return whitelist.some(domain => urlObj.hostname.endsWith(domain))
|
return whitelist.some(domain => urlObj.hostname.endsWith(domain))
|
||||||
|
Loading…
Reference in New Issue
Block a user