mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
chore(nuxt): update to new hasProtocol
options format (#19555)
This commit is contained in:
parent
d469740105
commit
9a5e3e3044
@ -192,7 +192,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
|
||||
return false
|
||||
}
|
||||
|
||||
return to.value === '' || hasProtocol(to.value, true)
|
||||
return to.value === '' || hasProtocol(to.value, { acceptRelative: true })
|
||||
})
|
||||
|
||||
// Prefetching
|
||||
|
@ -41,7 +41,7 @@ function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) {
|
||||
if (u.search) {
|
||||
throw new Error('Payload URL cannot contain search params: ' + url)
|
||||
}
|
||||
if (u.host !== 'localhost' || hasProtocol(u.pathname, true)) {
|
||||
if (u.host !== 'localhost' || hasProtocol(u.pathname, { acceptRelative: true })) {
|
||||
throw new Error('Payload URL must not include hostname: ' + url)
|
||||
}
|
||||
const hash = opts.hash || (opts.fresh ? Date.now() : '')
|
||||
|
@ -80,7 +80,7 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
|
||||
}
|
||||
|
||||
const toPath = typeof to === 'string' ? to : ((to as RouteLocationPathRaw).path || '/')
|
||||
const isExternal = hasProtocol(toPath, true)
|
||||
const isExternal = hasProtocol(toPath, { acceptRelative: true })
|
||||
if (isExternal && !options?.external) {
|
||||
throw new Error('Navigating to external URL is not allowed by default. Use `navigateTo (url, { external: true })`.')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user