mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Avoid crash (OOM) when content is too long.
This commit is contained in:
+5
@@ -34,6 +34,11 @@ internal class FormattedJsonHttpLogger(
|
|||||||
// It can be only the case if we log the bodies of Http requests.
|
// It can be only the case if we log the bodies of Http requests.
|
||||||
if (level != HttpLoggingInterceptor.Level.BODY) return
|
if (level != HttpLoggingInterceptor.Level.BODY) return
|
||||||
|
|
||||||
|
if (message.length > 100_000) {
|
||||||
|
Timber.d("Content is too long (${message.length} chars) to be formatted as JSON")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (message.startsWith("{")) {
|
if (message.startsWith("{")) {
|
||||||
// JSON Detected
|
// JSON Detected
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user