mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[fix] Prevent crash on local calibre OPDS server (#5572)
Close: #5476 - Prevent segmentation fault when we enter incorrect address of calibre opds server (eg http://192.168.1.1:8080/ instead of proper http://192.168.1.1:8080/opds - prevent unnecessary infos in Gutenberg OPDS
This commit is contained in:
@@ -84,7 +84,7 @@ function OPDSParser:parse(text)
|
||||
return s:gsub( "%p", {["&"] = "&", ["<"] = "<", [">"] = ">" } )
|
||||
end )
|
||||
local xlex = luxl.new(text, #text)
|
||||
return self:createFlatXTable(xlex)
|
||||
return assert(self:createFlatXTable(xlex))
|
||||
end
|
||||
|
||||
return OPDSParser
|
||||
|
||||
@@ -298,6 +298,9 @@ function OPDSBrowser:fetchFeed(item_url, username, password, method)
|
||||
if xml ~= "" then
|
||||
return xml
|
||||
end
|
||||
elseif method == "HEAD" then
|
||||
-- Don't show error messages when we check headers only.
|
||||
return
|
||||
elseif code == 301 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("The catalog has been permanently moved. Please update catalog URL to '%1'."), headers['Location']),
|
||||
@@ -401,6 +404,11 @@ function OPDSBrowser:genItemTableFromCatalog(catalog, item_url, username, passwo
|
||||
end
|
||||
|
||||
if not feed.entry then
|
||||
if #hrefs == 0 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Catalog not found."),
|
||||
})
|
||||
end
|
||||
return item_table
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user