ipx 0.9.1 → 0.9.2

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.
@@ -116,12 +116,12 @@ const createHTTPSource = (options) => {
116
116
  }
117
117
  const hosts = domains.map((domain) => ufo.parseURL(domain, "https://").host);
118
118
  return async (id, reqOptions) => {
119
- const parsedUrl = ufo.parseURL(id, "https://");
120
- if (!parsedUrl.host) {
119
+ const url = new URL(id);
120
+ if (!url.hostname) {
121
121
  throw createError("Hostname is missing: " + id, 403);
122
122
  }
123
- if (!reqOptions?.bypassDomain && !hosts.find((host) => parsedUrl.host === host)) {
124
- throw createError("Forbidden host: " + parsedUrl.host, 403);
123
+ if (!reqOptions?.bypassDomain && !hosts.find((host) => url.hostname === host)) {
124
+ throw createError("Forbidden host: " + url.hostname, 403);
125
125
  }
126
126
  const response = await ohmyfetch.fetch(id, {
127
127
  agent: id.startsWith("https") ? httpsAgent : httpAgent
@@ -104,12 +104,12 @@ const createHTTPSource = (options) => {
104
104
  }
105
105
  const hosts = domains.map((domain) => parseURL(domain, "https://").host);
106
106
  return async (id, reqOptions) => {
107
- const parsedUrl = parseURL(id, "https://");
108
- if (!parsedUrl.host) {
107
+ const url = new URL(id);
108
+ if (!url.hostname) {
109
109
  throw createError("Hostname is missing: " + id, 403);
110
110
  }
111
- if (!reqOptions?.bypassDomain && !hosts.find((host) => parsedUrl.host === host)) {
112
- throw createError("Forbidden host: " + parsedUrl.host, 403);
111
+ if (!reqOptions?.bypassDomain && !hosts.find((host) => url.hostname === host)) {
112
+ throw createError("Forbidden host: " + url.hostname, 403);
113
113
  }
114
114
  const response = await fetch(id, {
115
115
  agent: id.startsWith("https") ? httpsAgent : httpAgent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipx",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "repository": "unjs/ipx",
5
5
  "license": "MIT",
6
6
  "exports": {