From 5d0ae3dde8729f4dbf761b6e018a2121f7e37e1b Mon Sep 17 00:00:00 2001 From: John Beard Date: Mon, 23 Aug 2021 07:51:33 +0100 Subject: [PATCH] WebDAV: Handle non-self-closing tag for empty collection (#8121) Some servers serve rather than . So handle this case when deciding if an item is not a collection. --- frontend/apps/cloudstorage/webdavapi.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/apps/cloudstorage/webdavapi.lua b/frontend/apps/cloudstorage/webdavapi.lua index 2221d90aa..d61dd81a2 100644 --- a/frontend/apps/cloudstorage/webdavapi.lua +++ b/frontend/apps/cloudstorage/webdavapi.lua @@ -116,6 +116,9 @@ function WebDavApi:listFolder(address, user, pass, folder_path) end local is_current_dir = self:isCurrentDirectory( item_fullpath, address, path ) local item_name = util.urlDecode( FFIUtil.basename( item_fullpath ) ) + local is_not_collection = item:find("<[^:]*:resourcetype/>") or + item:find("<[^:]*:resourcetype>") + local item_path = path .. "/" .. item_name if item:find("<[^:]*:collection/>") then item_name = item_name .. "/" @@ -126,7 +129,7 @@ function WebDavApi:listFolder(address, user, pass, folder_path) type = "folder", }) end - elseif item:find("<[^:]*:resourcetype/>") and (DocumentRegistry:hasProvider(item_name) + elseif is_not_collection and (DocumentRegistry:hasProvider(item_name) or G_reader_settings:isTrue("show_unsupported")) then table.insert(webdav_file, { text = item_name,