url-sanitizer 5.3.0 → 5.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/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  "engines": {
81
81
  "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
82
82
  },
83
- "version": "5.3.0"
83
+ "version": "5.3.2"
84
84
  }
package/src/mjs/filter.js CHANGED
@@ -68,9 +68,10 @@ export class SanitizeContext {
68
68
  * @param {InternalSanitizeOptions} opt - The internal sanitization options.
69
69
  */
70
70
  #compileRules(opt) {
71
- const { allowRelative, debug, allow, deny, only } = opt;
71
+ const { allowRelative, debug, allow, deny, only, schemes } = opt;
72
72
  this.allowRelative = !!allowRelative;
73
73
  this.debug = !!debug;
74
+ this.schemes = schemes;
74
75
  if (Array.isArray(only) && only.length) {
75
76
  this.restrictScheme = true;
76
77
  for (const scheme of only) {
@@ -197,7 +198,11 @@ export class SanitizeFilter {
197
198
  ) {
198
199
  return null;
199
200
  }
200
- } else if (ctx.schemeMap.get(scheme) === false) {
201
+ } else if (ctx.schemeMap.has(scheme)) {
202
+ if (ctx.schemeMap.get(scheme) === false) {
203
+ return null;
204
+ }
205
+ } else if (!ctx.schemes.has(scheme)) {
201
206
  return null;
202
207
  }
203
208
  if (scheme === 'data') {