unprint 0.18.15 → 0.18.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app.js +2 -27
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -374,34 +374,9 @@ function prefixUrl(urlPath, originUrl, customOptions) {
|
|
|
374
374
|
...customOptions,
|
|
375
375
|
};
|
|
376
376
|
|
|
377
|
-
|
|
378
|
-
// this is already a complete URL
|
|
379
|
-
return urlPath;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (options.protocol && /^\/\//.test(urlPath)) {
|
|
383
|
-
return `${options.protocol.replace(/:$/, '')}:${urlPath}`; // allow protocol to be defined either as 'https' or 'https:'
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (!originUrl) {
|
|
387
|
-
return urlPath;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const { origin, protocol } = new URL(originUrl);
|
|
391
|
-
|
|
392
|
-
if (protocol && /^\/\//.test(urlPath)) {
|
|
393
|
-
return `${protocol}${urlPath}`;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
if (/^\//.test(urlPath)) {
|
|
397
|
-
return `${origin}${urlPath}`;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (/^\.\//.test(urlPath)) {
|
|
401
|
-
return `${originUrl.replace(/\/+$/, '')}${urlPath.slice(1)}`;
|
|
402
|
-
}
|
|
377
|
+
const origin = originUrl?.replace(/^.*?:/, `${options.protocol}:`);
|
|
403
378
|
|
|
404
|
-
return
|
|
379
|
+
return new URL(urlPath, origin).href;
|
|
405
380
|
}
|
|
406
381
|
|
|
407
382
|
// legacy argument
|