@instructure/platform-sanitize 0.2.2 → 0.3.0

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/dist/index.js CHANGED
@@ -189,14 +189,14 @@ function g() {
189
189
  (t.getAttribute("srcset") ?? "").split(",").map((r) => r.trim().split(/\s+/)[0]).some((r) => l.test(r)) && t.removeAttribute("srcset");
190
190
  }), o);
191
191
  }
192
- function b(t) {
192
+ function p(t) {
193
193
  if (typeof window > "u")
194
194
  throw new Error("sanitizeHtml requires a DOM environment (window is not defined)");
195
195
  return g().sanitize(t ?? "", f);
196
196
  }
197
- const m = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), s = "http://platform-sanitize.invalid/";
198
- function p(t) {
199
- if (!t || !t.trim()) return "about:blank";
197
+ const m = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), s = "http://platform-sanitize.invalid/", u = /^\s*\/\//;
198
+ function h(t) {
199
+ if (!t || !t.trim() || u.test(t)) return "about:blank";
200
200
  try {
201
201
  const e = new URL(t, s);
202
202
  return m.has(e.protocol) ? e.href.startsWith(s) ? t : e.href : "about:blank";
@@ -205,6 +205,6 @@ function p(t) {
205
205
  }
206
206
  }
207
207
  export {
208
- b as sanitizeHtml,
209
- p as sanitizeUrl
208
+ p as sanitizeHtml,
209
+ h as sanitizeUrl
210
210
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAiBA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAYlE"}
1
+ {"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAwBA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAalE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/platform-sanitize",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",