next.js
a5e2a02f - fix: `normalize-asset-prefix` adding leading slash when URL `assetPrefix` is provided (#68518)

Commit
1 year ago
fix: `normalize-asset-prefix` adding leading slash when URL `assetPrefix` is provided (#68518) ### Why? URL validation of `normalizeAssetPrefix` was wrong as it checks if is starting with `://`: https://github.com/vercel/next.js/blob/37df9ab243690187725a236cbf2debbcaeb33cfa/packages/next/src/shared/lib/normalized-asset-prefix.ts#L4-L7 This resulted the value to be `/https://example.com` instead of `example.com`. x-ref: https://github.com/vercel/next.js/pull/68518#discussion_r1705162752 ### How? As `normalizeAssetPrefix` function was added for `getSocketUrl`, it removes the protocol of the URL. But for reusability, this could be a friction to other callers. Therefore we validate the URL and let the callers handle the URL (e.g. protocol).
Author
Parents
Loading