Skip to content

Commit

Permalink
fix(nuxt): restore previous check on payload url
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 16, 2023
1 parent 1e8b27f commit e9ff34a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/nuxt/src/app/composables/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export function preloadPayload (url: string, opts: LoadPayloadOptions = {}) {
// --- Internal ---

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')
if (u.search) {
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() : '')
return joinURL(useRuntimeConfig().app.baseURL, u.pathname, hash ? `_payload.${hash}.js` : '_payload.js')
}
Expand Down

0 comments on commit e9ff34a

Please sign in to comment.