mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(nuxt): restore previous check on payload url
This commit is contained in:
parent
1e8b27f36c
commit
e9ff34ace4
@ -37,13 +37,13 @@ export function preloadPayload (url: string, opts: LoadPayloadOptions = {}) {
|
|||||||
// --- Internal ---
|
// --- Internal ---
|
||||||
|
|
||||||
function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) {
|
function _getPayloadURL (url: string, opts: LoadPayloadOptions = {}) {
|
||||||
if (hasProtocol(url, true)) {
|
|
||||||
throw new Error('Payload URL must not include hostname: ' + url)
|
|
||||||
}
|
|
||||||
const u = new URL(url, 'http://localhost')
|
const u = new URL(url, 'http://localhost')
|
||||||
if (u.search) {
|
if (u.search) {
|
||||||
throw new Error('Payload URL cannot contain search params: ' + url)
|
throw new Error('Payload URL cannot contain search params: ' + url)
|
||||||
}
|
}
|
||||||
|
if (u.host !== 'localhost' || hasProtocol(url, true)) {
|
||||||
|
throw new Error('Payload URL must not include hostname: ' + url)
|
||||||
|
}
|
||||||
const hash = opts.hash || (opts.fresh ? Date.now() : '')
|
const hash = opts.hash || (opts.fresh ? Date.now() : '')
|
||||||
return joinURL(useRuntimeConfig().app.baseURL, u.pathname, hash ? `_payload.${hash}.js` : '_payload.js')
|
return joinURL(useRuntimeConfig().app.baseURL, u.pathname, hash ? `_payload.${hash}.js` : '_payload.js')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user