fix: Redis expire guard, transferOwnership prev-owner, SVG regex
- Redis get() rejects legacy expire=0 entries and cleans them up - transferOwnership invalidates previous owner in addition to new - SVG regex uses non-greedy match and handles self-closing <svg /> - SVG fallback returns empty string instead of HTML wrapper - Memory channel comment: FIFO eviction, not timestamp-based
This commit is contained in:
4 files changed
+17
-3
No files matched your search
@@ -86,8 +86,8 @@ export const sanitizeSvg = (svgText: string) => {
|
||||
// linkedom's DOMParser omits html/body for fragment-only SVG; DOMPurify needs a body root.
|
||||
const wrapped = `<html><body>${svgText}</body></html>`;
|
||||
const sanitized = purify.sanitize(wrapped, svgSanitizeOptions);
|
||||
const svgMatch = sanitized.match(/<svg[\s\S]*<\/svg>/i);
|
||||
return svgMatch ? svgMatch[0] : sanitized;
|
||||
const svgMatch = sanitized.match(/<svg[\s\S]*?(?:<\/svg>|\/>)/i);
|
||||
return svgMatch ? svgMatch[0] : "";
|
||||
};
|
||||
|
||||
export { svgSanitizeOptions, purify };
|
||||
Reference in new issue
Block a user