Skip to content

Commit

Permalink
John/hig-1053-strictprivacy-mode-is-injecting-random (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
John Pham authored Sep 23, 2021
1 parent 13d3b9d commit ad2235f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@highlight-run/rrweb",
"version": "0.12.11",
"version": "0.12.12",
"description": "record and replay the web",
"scripts": {
"test": "npm run bundle:browser && cross-env TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register -r ignore-styles -r jsdom-global/register test/**.test.ts",
Expand Down
7 changes: 6 additions & 1 deletion src/snapshot/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,12 @@ function serializeNode(
'BODY',
'NOSCRIPT',
]);
if (!IGNORE_TAG_NAMES.has(parentTagName)) {
if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {
// We remove non-printing characters.
// For example: '‌' is a character that isn't shown visibly or takes up layout space on the screen. However if you take the length of the string, it's counted as 1.
// For example: "‌1"'s length is 2 but visually it's only taking up 1 character width.
// If we don't filter does out, our string obfuscation could have more characters than what was originally presented.
textContent = textContent.replace(/[^ -~]+/g, '');
textContent =
textContent
?.split(' ')
Expand Down

0 comments on commit ad2235f

Please sign in to comment.