[fix] Handle OPDS catalog responses accordingly (#5241)

- handle moved permanently HTTP 301
- handle authentication required HTTP 401
- handle authentication errors HTTP 403
- handle catalog not found HTTP 404
pull/5242/head
Edoardo Putti 5 years ago committed by Frans de Jonge
parent 73c8e5c5cd
commit 0906b69c06

@ -298,9 +298,25 @@ function OPDSBrowser:fetchFeed(item_url, username, password, method)
if xml ~= "" then
return xml
end
elseif code == 301 then
UIManager:show(InfoMessage:new{
text = T(_("The catalog has been permanently moved. Please update catalog URL to '%1'."), headers['Location']),
})
elseif code == 401 then
UIManager:show(InfoMessage:new{
text = T(_("Authentication required for catalog. Please add a username and password.")),
})
elseif code == 403 then
UIManager:show(InfoMessage:new{
text = T(_("Failed to authenticate. Please check your username and password.")),
})
elseif code == 404 then
UIManager:show(InfoMessage:new{
text = T(_("Catalog not found.")),
})
else
UIManager:show(InfoMessage:new{
text = T(_("Cannot get catalog. Server code response %1"), code),
text = T(_("Cannot get catalog. Server response code %1."), code),
})
end
end

Loading…
Cancel
Save