diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-04 02:27:44 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-04 02:27:44 -0500 |
commit | 702503db4ef28caefefbaabc27ccf161f1c54ed2 (patch) | |
tree | 7cc72da7883115ffd691fc84ee45b49ec24b830d /app/src/main/kotlin/com/pitchedapps | |
parent | 37cd65102f92334cf92a64637a354edeee8f1d25 (diff) | |
download | frost-702503db4ef28caefefbaabc27ccf161f1c54ed2.tar.gz frost-702503db4ef28caefefbaabc27ccf161f1c54ed2.tar.bz2 frost-702503db4ef28caefefbaabc27ccf161f1c54ed2.zip |
Try catch apache unescape, resolves #1300
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt | 7 |
1 files changed, 6 insertions, 1 deletions
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) |