@forge/egress
2.3.02.3.1-next.0
out/egress/url-parser.jsout/egress/url-parser.js+4−6
Index: package/out/egress/url-parser.js
===================================================================
--- package/out/egress/url-parser.js
+++ package/out/egress/url-parser.js
@@ -3,12 +3,10 @@
exports.parseUrl = void 0;
function parseUrl(url) {
var _a, _b;
const protocol = (_b = (_a = url.match(/^(.*?:)/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : 'https:';
- const hostname = url
- .replace(protocol, '')
- .replace(/^\/*/, '')
- .replace(/^\\*/, '')
- .split(/[\?\/]/)[0];
- return { protocol, hostname };
+ const hostAndPath = url.replace(protocol, '').replace(/^\/*/, '').replace(/^\\*/, '').split('?')[0].split('#')[0];
+ const hostname = hostAndPath.split('/')[0];
+ const pathname = hostAndPath.slice(hostname.length) || '/';
+ return { protocol, hostname, pathname };
}
exports.parseUrl = parseUrl;