Răsfoiți Sursa

Merge pull request #1868 from overleaf/bg-sanitise-error-for-google-analytics

sanitise error sent to google analytics

GitOrigin-RevId: 6307b7a54f18b9e8a1da31f45a5a148e1321db62
Simon Detheridge 7 ani în urmă
părinte
comite
3ce74a3877
1 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  1. 8 1
      services/web/public/src/ide/editor/Document.js

+ 8 - 1
services/web/public/src/ide/editor/Document.js

@@ -670,12 +670,19 @@ define([
           return
         }
         if (typeof ga === 'function') {
+          // sanitise the error message before sending (the "delete component"
+          // error in public/js/libs/sharejs.js includes the some document
+          // content).
+          let message = error.message
+          if (/^Delete component/.test(message)) {
+            message = 'Delete component does not match deleted text'
+          }
           ga(
             'send',
             'event',
             'error',
             'shareJsError',
-            `${error.message} - ${this.ide.socket.socket.transport.name}`
+            `${message} - ${this.ide.socket.socket.transport.name}`
           )
         }
         if (this.doc != null) {