diff --git a/frontend/apps/cloudstorage/webdavapi.lua b/frontend/apps/cloudstorage/webdavapi.lua index 43bd86862..ec5022163 100644 --- a/frontend/apps/cloudstorage/webdavapi.lua +++ b/frontend/apps/cloudstorage/webdavapi.lua @@ -95,13 +95,13 @@ function WebDavApi:listFolder(address, user, pass, folder_path, folder_mode) local item_name = ffiUtil.basename(util.htmlEntitiesToUtf8(util.urlDecode(item_fullpath))) local is_current_dir = self.trim_slashes(item_fullpath) == webdav_url_path local is_not_collection = item:find("<[^:]*:resourcetype%s*/>") or - item:find("<[^:]*:resourcetype>") + item:find("<[^:]*:resourcetype>%s*") local item_path = path .. "/" .. item_name -- only available for files, not directories/collections local item_filesize = item:match("<[^:]*:getcontentlength[^>]*>(%d+)") - if item:find("<[^:]*:collection[^<]*/>") then + if item:find("<[^:]*:collection[^<]*/>") or item:find("<[^:]*:collection>%s*") then item_name = item_name .. "/" if not is_current_dir then table.insert(webdav_list, { diff --git a/plugins/cloudstorage.koplugin/providers/webdav.lua b/plugins/cloudstorage.koplugin/providers/webdav.lua index 156d2e265..e54b3159e 100644 --- a/plugins/cloudstorage.koplugin/providers/webdav.lua +++ b/plugins/cloudstorage.koplugin/providers/webdav.lua @@ -102,7 +102,7 @@ function WebDavApi.listFolder(address, user, pass, folder_path, include_folders) local item_fullpath = util.urlDecode(item:match("<[^:]*:href[^>]*>(.*)")) local item_name = ffiUtil.basename(util.htmlEntitiesToUtf8(item_fullpath)) local is_not_collection = item:find("<[^:]*:resourcetype%s*/>") or - item:find("<[^:]*:resourcetype>") + item:find("<[^:]*:resourcetype>%s*") if is_not_collection then if show_unsupported or DocumentRegistry:hasProvider(item_name) then local file_size = tonumber(item:match("<[^:]*:getcontentlength[^>]*>(%d+)")) @@ -123,7 +123,7 @@ function WebDavApi.listFolder(address, user, pass, folder_path, include_folders) mandatory = mandatory, }) end - elseif item:find("<[^:]*:collection[^<]*/>") then + elseif item:find("<[^:]*:collection[^<]*/>") or item:find("<[^:]*:collection>%s*") then if include_folders then local is_not_current_dir = WebDavApi.trim_slashes(item_fullpath) ~= webdav_url_path if is_not_current_dir then