← back to Rentv 2026
pr/adapters: Cody gate — decode & LAST in stripTags (after the numeric passes). Decoding it first turned a double-encoded '&' (literal '&') into '&' then the numeric pass collapsed it to '&' — corrupting the intended literal. Moved to last so double-encoded refs survive; single-encoded &/& still decode. Verified
e246fdef43a0e380e50ef7f36e5cf7482b9b060d · 2026-08-06 01:29:48 -0700 · Steve
Files touched
M src/pr/adapters/index.js
Diff
commit e246fdef43a0e380e50ef7f36e5cf7482b9b060d
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Aug 6 01:29:48 2026 -0700
pr/adapters: Cody gate — decode & LAST in stripTags (after the numeric passes). Decoding it first turned a double-encoded '&#38;' (literal '&') into '&' then the numeric pass collapsed it to '&' — corrupting the intended literal. Moved to last so double-encoded refs survive; single-encoded &/& still decode. Verified
---
src/pr/adapters/index.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/pr/adapters/index.js b/src/pr/adapters/index.js
index fe4ba47b..e524d715 100644
--- a/src/pr/adapters/index.js
+++ b/src/pr/adapters/index.js
@@ -87,13 +87,16 @@ function stripTags(html) {
const num = (n) => { try { return (n >= 32 && n !== 127) ? String.fromCodePoint(n) : ' '; } catch { return ' '; } };
return String(html || '')
.replace(/<script[\s\S]*?<\/script>/gi, ' ').replace(/<style[\s\S]*?<\/style>/gi, ' ')
- .replace(/<[^>]+>/g, ' ').replace(/ /g, ' ').replace(/&/g, '&')
+ .replace(/<[^>]+>/g, ' ').replace(/ /g, ' ')
.replace(/�?39;|’|‘|’/g, "'").replace(/"|“|”/g, '"')
.replace(/–|–/g, '\u2013').replace(/—|—/g, '\u2014')
.replace(/…/g, '\u2026').replace(/®/g, '\u00ae').replace(/©/g, '\u00a9').replace(/™/g, '\u2122')
// numeric character references (decimal + hex) \u2014 covers & é … & that named-only decoding misses
.replace(/&#(\d{1,7});/g, (_, n) => num(+n))
.replace(/&#x([0-9a-f]{1,6});/gi, (_, h) => num(parseInt(h, 16)))
+ // & decoded LAST (after the numeric passes) so a double-encoded '&#38;' stays the literal
+ // text '&' instead of collapsing to '&' \u2014 the numeric pass can't match while the & is still &
+ .replace(/&/g, '&')
.replace(/\s+/g, ' ').trim();
}
← 8d77a6f0 pr/adapters: stripTags now decodes numeric character referen
·
back to Rentv 2026
·
auto-save: 2026-08-06T01:47:30 (7 files) — data/deals-regist 9bdae722 →