url-sanitizer 0.9.9 → 0.9.13
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/README.md +1 -1
- package/dist/url-sanitizer-wo-dompurify.js +5 -5
- package/dist/url-sanitizer-wo-dompurify.js.map +2 -2
- package/dist/url-sanitizer-wo-dompurify.min.js +1 -1
- package/dist/url-sanitizer-wo-dompurify.min.js.map +3 -3
- package/dist/url-sanitizer.js +4 -4
- package/dist/url-sanitizer.js.map +2 -2
- package/dist/url-sanitizer.min.js +1 -1
- package/dist/url-sanitizer.min.js.map +3 -3
- package/package.json +2 -2
- package/src/mjs/sanitizer.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "url-sanitizer",
|
|
3
|
-
"description": "URL sanitizer for Node.js
|
|
3
|
+
"description": "URL sanitizer for Node.js, browsers and web sites.",
|
|
4
4
|
"author": "asamuzaK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/asamuzaK/urlSanitizer",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"test-bdd": "http-server ./ -c-1 -o test/bdd/url-sanitizer.test.html",
|
|
72
72
|
"tsc": "node modules/index clean --dir=types -i && npx tsc"
|
|
73
73
|
},
|
|
74
|
-
"version": "0.9.
|
|
74
|
+
"version": "0.9.13"
|
|
75
75
|
}
|
package/src/mjs/sanitizer.js
CHANGED
|
@@ -20,10 +20,10 @@ const REG_END_NUM = /(?:#|%23)$/;
|
|
|
20
20
|
const REG_END_QUEST = /(?<!(?:#|%23).*)(?:\?|%3F)$/;
|
|
21
21
|
const REG_HTML_SP = /[<>"'\s]/g;
|
|
22
22
|
const REG_HTML_URL_ENC = /%(?:2(?:2|7)|3(?:C|E))/g;
|
|
23
|
-
const REG_HTML_URL_ENC_QUOT = /%(?:2(?:2|7)|3(?:C|E))|["']/;
|
|
24
23
|
const REG_MIME_DOM =
|
|
25
24
|
/^(?:text\/(?:ht|x)ml|application\/(?:[\w#&\-.;]+\+)?xml|image\/svg\+xml)/;
|
|
26
25
|
const REG_SCRIPT_BLOB = /(?:java|vb)script|blob/;
|
|
26
|
+
const REG_TAG_QUOT = /%(?:2(?:2|7)|3(?:C|E))|[<>"']/;
|
|
27
27
|
const REG_URL_ENC_AMP = /%26/g;
|
|
28
28
|
|
|
29
29
|
/* typedef */
|
|
@@ -280,8 +280,8 @@ export class URLSanitizer extends URISchemes {
|
|
|
280
280
|
} else {
|
|
281
281
|
finalize = true;
|
|
282
282
|
}
|
|
283
|
-
if (!isDataUrl && remove &&
|
|
284
|
-
const item =
|
|
283
|
+
if (!isDataUrl && remove && REG_TAG_QUOT.test(urlToSanitize)) {
|
|
284
|
+
const item = REG_TAG_QUOT.exec(urlToSanitize);
|
|
285
285
|
const { index } = item;
|
|
286
286
|
urlToSanitize = urlToSanitize.substring(0, index);
|
|
287
287
|
}
|