CloudStorage: log error (#7694)

References <https://github.com/koreader/koreader/issues/7688>.
pull/7700/head
Frans de Jonge 3 years ago committed by GitHub
parent 834feef8cd
commit 529c681851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,6 +11,7 @@ local Menu = require("ui/widget/menu")
local UIManager = require("ui/uimanager")
local WebDav = require("apps/cloudstorage/webdav")
local lfs = require("libs/libkoreader-lfs")
local logger = require("logger")
local T = require("ffi/util").template
local _ = require("gettext")
local Screen = require("device").screen
@ -147,28 +148,29 @@ function CloudStorage:selectCloudType()
end
function CloudStorage:openCloudServer(url)
local tbl
local tbl, e
local NetworkMgr = require("ui/network/manager")
if self.type == "dropbox" then
if NetworkMgr:willRerunWhenOnline(function() self:openCloudServer(url) end) then
return
end
tbl = DropBox:run(url, self.password, self.choose_folder_mode)
tbl, e = DropBox:run(url, self.password, self.choose_folder_mode)
elseif self.type == "ftp" then
if NetworkMgr:willRerunWhenConnected(function() self:openCloudServer(url) end) then
return
end
tbl = Ftp:run(self.address, self.username, self.password, url)
tbl, e = Ftp:run(self.address, self.username, self.password, url)
elseif self.type == "webdav" then
if NetworkMgr:willRerunWhenConnected(function() self:openCloudServer(url) end) then
return
end
tbl = WebDav:run(self.address, self.username, self.password, url)
tbl, e = WebDav:run(self.address, self.username, self.password, url)
end
if tbl and #tbl > 0 then
self:switchItemTable(url, tbl)
return true
elseif not tbl then
logger.err("CloudStorage:", e)
UIManager:show(InfoMessage:new{
text = _("Cannot fetch list of folder contents\nPlease check your configuration or network connection."),
timeout = 3,

@ -39,8 +39,10 @@ function FtpApi:listFolder(address_path, folder_path)
local file_name
local tbl = {}
local sink = ltn12.sink.table(tbl)
local ls_ftp = self:ftpGet(address_path, "nlst", sink)
if ls_ftp == nil then return false end
local ls_ftp, e = self:ftpGet(address_path, "nlst", sink)
if ls_ftp == nil then
return false, e
end
if folder_path == "/" then
folder_path = ""
end

Loading…
Cancel
Save