Merge pull request #4782 from keymanapp/fix/android/sanitize-kmw-error-breadcrumbs

fix(android/engine): Sanitize embedded KMW Sentry error
This commit is contained in:
Darcy Wong 2021-03-25 15:37:48 +07:00 committed by GitHub
commit 83d5cff078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -156,7 +156,10 @@ final class KMKeyboard extends WebView {
if ((cm.messageLevel() == ConsoleMessage.MessageLevel.ERROR) && (!cm.message().startsWith("No keyboard stubs exist"))) {
// Make Toast notification of error and send log about falling back to default keyboard (ignore language ID)
sendKMWError(cm.lineNumber(), cm.sourceId(), cm.message());
// Sanitize sourceId info
String NAVIGATION_PATTERN = "^(.*)?(keyboard\\.html#[^-]+)-.*$";
String sourceID = cm.sourceId().replaceAll(NAVIGATION_PATTERN, "$1$2");
sendKMWError(cm.lineNumber(), sourceID, cm.message());
sendError(packageID, keyboardID, "");
Keyboard firstKeyboard = KeyboardController.getInstance().getKeyboardInfo(0);
if (firstKeyboard != null) {