fix(nuxt): restore previous check on payload url

This commit is contained in:
Daniel Roe 2023-02-16 16:59:06 +00:00
parent 1e8b27f36c
commit e9ff34ace4
1 changed files with 3 additions and 3 deletions

View File

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