@instructure/platform-sanitize 0.3.0 → 0.3.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.
- package/dist/index.js +5 -3
- package/dist/sanitizeUrl.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -196,10 +196,12 @@ function p(t) {
|
|
|
196
196
|
}
|
|
197
197
|
const m = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:"]), s = "http://platform-sanitize.invalid/", u = /^\s*\/\//;
|
|
198
198
|
function h(t) {
|
|
199
|
-
if (!t || !t.trim()
|
|
199
|
+
if (!t || !t.trim()) return "about:blank";
|
|
200
|
+
const e = t.replace(/\\/g, "/");
|
|
201
|
+
if (u.test(e)) return "about:blank";
|
|
200
202
|
try {
|
|
201
|
-
const
|
|
202
|
-
return m.has(
|
|
203
|
+
const i = new URL(e, s);
|
|
204
|
+
return m.has(i.protocol) ? i.href.startsWith(s) ? t : e.replace(/[\x00-\x1F]/g, "") : "about:blank";
|
|
203
205
|
} catch {
|
|
204
206
|
return "about:blank";
|
|
205
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizeUrl.d.ts","sourceRoot":"","sources":["../src/sanitizeUrl.ts"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAoBlE"}
|