chore(nuxt): update to new hasProtocol options format (#19555)

This commit is contained in:
Daniel Roe 2023-03-09 18:37:18 +00:00 committed by GitHub
parent d469740105
commit 9a5e3e3044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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() : '')

View File

@ -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 })`.')
}