From 702503db4ef28caefefbaabc27ccf161f1c54ed2 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 4 Jan 2019 02:27:44 -0500 Subject: Try catch apache unescape, resolves #1300 --- .../kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src/main/kotlin/com/pitchedapps') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt index aa8dc58e..16ddb7e1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt @@ -35,6 +35,7 @@ import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.logging.HttpLoggingInterceptor import org.apache.commons.text.StringEscapeUtils +import java.lang.Exception /** * Created by Allan Wang on 21/12/17. @@ -119,7 +120,11 @@ fun String.getAuth(): RequestAuth { .call() call.execute().body()?.charStream()?.useLines { lines -> lines.forEach { - val text = StringEscapeUtils.unescapeEcmaScript(it) + val text = try { + StringEscapeUtils.unescapeEcmaScript(it) + } catch (ignore: Exception) { + return@forEach + } val fb_dtsg = FB_DTSG_MATCHER.find(text)[1] if (fb_dtsg != null) { auth = auth.copy(fb_dtsg = fb_dtsg) -- cgit v1.2.3