From 059ffc0040ab8b993765e1069bfb4f9c06336cdd Mon Sep 17 00:00:00 2001 From: Galunid Date: Thu, 3 Dec 2020 15:38:31 +0100 Subject: [PATCH] Fix bad authentication handling in opds browser (#6942) Fixes #6941. --- frontend/ui/widget/opdsbrowser.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/ui/widget/opdsbrowser.lua b/frontend/ui/widget/opdsbrowser.lua index b1277115c..d6914d1f5 100644 --- a/frontend/ui/widget/opdsbrowser.lua +++ b/frontend/ui/widget/opdsbrowser.lua @@ -568,12 +568,11 @@ function OPDSBrowser:downloadFile(item, format, remote_url) password = item.password } elseif parsed.scheme == "https" then - local auth = string.format("%s:%s", item.username, item.password) + local auth = (item.username and item.password) and string.format("%s:%s", item.username, item.password) or nil local hostname = parsed.host - dummy, c = http.request { url = remote_url, - headers = { Authorization = "Basic " .. mime.b64(auth), ["Host"] = hostname }, + headers = auth and { Authorization = "Basic " .. mime.b64(auth), ["Host"] = hostname } or nil, sink = ltn12.sink.file(io.open(local_path, "w")), } else