From 143f815f542bd07d3c70b0602ca7240bf9a9a08f Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Wed, 3 May 2023 11:56:47 +0200 Subject: [PATCH] fix(tracker): fix email detection performance --- tracker/tracker/CHANGELOG.md | 3 ++- tracker/tracker/src/main/app/sanitizer.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tracker/tracker/CHANGELOG.md b/tracker/tracker/CHANGELOG.md index 5b18ad276..dd9840daf 100644 --- a/tracker/tracker/CHANGELOG.md +++ b/tracker/tracker/CHANGELOG.md @@ -1,10 +1,11 @@ # 7.0.0 - **[breaking]** added gzip compression to large messages +- fix email regexp to significantly improve performance # 6.0.2 -- fix network tracking for samedomain iframes created by js code +- fix network tracking for same domain iframes created by js code # 6.0.1 diff --git a/tracker/tracker/src/main/app/sanitizer.ts b/tracker/tracker/src/main/app/sanitizer.ts index 202e459fc..3b30bdefa 100644 --- a/tracker/tracker/src/main/app/sanitizer.ts +++ b/tracker/tracker/src/main/app/sanitizer.ts @@ -68,7 +68,7 @@ export default class Sanitizer { } if (this.options.obscureTextEmails) { data = data.replace( - /([^\s]+)@([^\s]+)\.([^\s]+)/g, + /^\w+([.-]\w+)*@\w+([.-]\w+)*\.\w{2,3}$/g, (...f: Array) => stars(f[1]) + '@' + stars(f[2]) + '.' + stars(f[3]), ) }