From 0f55687a4db50b62074cddfede4c071b74e8688b Mon Sep 17 00:00:00 2001 From: lyluqo Date: Sun, 21 Jun 2026 17:49:32 -0300 Subject: [PATCH] [plugin] NewsDownloader: fix behavior when there's no HTTP status code (#15578) --- plugins/newsdownloader.koplugin/epubdownloadbackend.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/newsdownloader.koplugin/epubdownloadbackend.lua b/plugins/newsdownloader.koplugin/epubdownloadbackend.lua index 5d541ee23..e2e4861ba 100644 --- a/plugins/newsdownloader.koplugin/epubdownloadbackend.lua +++ b/plugins/newsdownloader.koplugin/epubdownloadbackend.lua @@ -264,10 +264,6 @@ local function getUrlContent(url, cookies, timeout, maxtime, add_to_cache, extra logger.warn("request interrupted:", status or code) return false, nil, code end - if code >= 400 and code < 500 then - logger.warn("HTTP error:", status or code) - return false, nil, status or code - end if headers == nil then logger.warn("No HTTP headers:", status or code or "network unreachable") return false, nil, "Network or remote server unavailable" @@ -279,6 +275,10 @@ local function getUrlContent(url, cookies, timeout, maxtime, add_to_cache, extra return false, nil, "Incomplete content received" end end + if code >= 400 and code < 500 then + logger.warn("HTTP error:", status or code) + return false, nil, status or code + end if add_to_cache then logger.dbg("Adding to cache", url)