Skip to content

Commit

Permalink
fix: expect spec-compliant URL
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-guggisberg committed Mar 18, 2022
1 parent 23b45a1 commit d65428a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/steps/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ export function optimizeImageURL(src, width, format = 'webply', optimize = 'medi
* @returns {string} resolved url
*/
export function resolveUrl(from, to) {
const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
if (resolvedUrl.protocol === 'resolve:') {
const DUMMY_BASE = 'https://__dummmy__';
const resolvedUrl = new URL(to, new URL(from, DUMMY_BASE));
if (resolvedUrl.origin === DUMMY_BASE) {
// `from` is a relative URL.
const { pathname, search, hash } = resolvedUrl;
return pathname + search + hash;
Expand Down

0 comments on commit d65428a

Please sign in to comment.