From d8c8e2d3a6c2db18b717d53bf5e392bde8e74639 Mon Sep 17 00:00:00 2001 From: mueller-ma Date: Tue, 16 Jul 2024 19:59:31 +0200 Subject: [PATCH] Don't cache responses with 0 content length (#3743) I noticed that myopenhab.org sometimes returns http code 200 for an icon and a valid svg content type, but the content length is 0. In that case, change to http code to 500 to avoid caching. Fixes #3733 Signed-off-by: mueller-ma --- mobile/src/main/java/org/openhab/habdroid/util/HttpClient.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/java/org/openhab/habdroid/util/HttpClient.kt b/mobile/src/main/java/org/openhab/habdroid/util/HttpClient.kt index d82ba314ea..3c6bf9dc57 100644 --- a/mobile/src/main/java/org/openhab/habdroid/util/HttpClient.kt +++ b/mobile/src/main/java/org/openhab/habdroid/util/HttpClient.kt @@ -206,7 +206,7 @@ class HttpClient(client: OkHttpClient, baseUrl: String?, username: String?, pass HttpException(call.request(), url, response.message, response.code) ) } - body == null -> { + body == null || body.contentLength() == 0L -> { cont.resumeWithException(HttpException(call.request(), url, "Empty body", 500)) } else -> {