From 840f6b0ced2433d61ddc71b09061b14da566a898 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Thu, 15 Jun 2017 12:47:40 +0100 Subject: [PATCH] [android][auth] Update code regex pattern to handle messages contained within the code brackets --- .../main/java/io/invertase/firebase/auth/RNFirebaseAuth.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java index 0dd36723..c223144c 100644 --- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java +++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java @@ -718,9 +718,9 @@ public class RNFirebaseAuth extends ReactContextBaseJavaModule { code = authException.getErrorCode(); message = authException.getMessage(); } catch (Exception e) { - Matcher matcher = Pattern.compile("\\[(.*?)\\]").matcher(message); + Matcher matcher = Pattern.compile("\\[(.*):.*\\]").matcher(message); if (matcher.find()) { - code = matcher.group().substring(2, matcher.group().length() - 2).trim(); + code = matcher.group(1).trim(); switch (code) { case "INVALID_CUSTOM_TOKEN": message = "The custom token format is incorrect. Please check the documentation.";