diff --git a/packages/nuxt/src/app/components/nuxt-link.ts b/packages/nuxt/src/app/components/nuxt-link.ts index 4bd7d8c937..1d384499af 100644 --- a/packages/nuxt/src/app/components/nuxt-link.ts +++ b/packages/nuxt/src/app/components/nuxt-link.ts @@ -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 diff --git a/packages/nuxt/src/app/composables/payload.ts b/packages/nuxt/src/app/composables/payload.ts index 523e807e34..2825d431e5 100644 --- a/packages/nuxt/src/app/composables/payload.ts +++ b/packages/nuxt/src/app/composables/payload.ts @@ -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() : '') diff --git a/packages/nuxt/src/app/composables/router.ts b/packages/nuxt/src/app/composables/router.ts index 8650778a99..ec5897d795 100644 --- a/packages/nuxt/src/app/composables/router.ts +++ b/packages/nuxt/src/app/composables/router.ts @@ -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 })`.') }