fix(cloudstorage): webdav not listing folders (#15532)
my webdav server (using [dav-server](https://crates.io/crates/dav-server/)) returns ```xml <D:collection></D:collection> ``` instead of ```xml <D:collection/> ```
This commit is contained in:
1 parent
5598a6ee44
commit
221547722b
2 files changed
+4
-4
No files matched your search
@@ -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></[^:]*:resourcetype>")
|
||||
item:find("<[^:]*:resourcetype>%s*</[^:]*:resourcetype>")
|
||||
local item_path = path .. "/" .. item_name
|
||||
|
||||
-- only available for files, not directories/collections
|
||||
local item_filesize = item:match("<[^:]*:getcontentlength[^>]*>(%d+)</[^:]*:getcontentlength>")
|
||||
|
||||
if item:find("<[^:]*:collection[^<]*/>") then
|
||||
if item:find("<[^:]*:collection[^<]*/>") or item:find("<[^:]*:collection>%s*</[^:]*:collection>") then
|
||||
item_name = item_name .. "/"
|
||||
if not is_current_dir then
|
||||
table.insert(webdav_list, {
|
||||
|
||||
@@ -102,7 +102,7 @@ function WebDavApi.listFolder(address, user, pass, folder_path, include_folders)
|
||||
local item_fullpath = util.urlDecode(item:match("<[^:]*:href[^>]*>(.*)</[^:]*:href>"))
|
||||
local item_name = ffiUtil.basename(util.htmlEntitiesToUtf8(item_fullpath))
|
||||
local is_not_collection = item:find("<[^:]*:resourcetype%s*/>") or
|
||||
item:find("<[^:]*:resourcetype></[^:]*:resourcetype>")
|
||||
item:find("<[^:]*:resourcetype>%s*</[^:]*:resourcetype>")
|
||||
if is_not_collection then
|
||||
if show_unsupported or DocumentRegistry:hasProvider(item_name) then
|
||||
local file_size = tonumber(item:match("<[^:]*:getcontentlength[^>]*>(%d+)</[^:]*:getcontentlength>"))
|
||||
@@ -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*</[^:]*:collection>") then
|
||||
if include_folders then
|
||||
local is_not_current_dir = WebDavApi.trim_slashes(item_fullpath) ~= webdav_url_path
|
||||
if is_not_current_dir then
|
||||
|
||||
Reference in new issue
Block a user