From dac3940ced1bbe326024a0b1967fe9974f71ed1d Mon Sep 17 00:00:00 2001 From: John Beard Date: Fri, 27 Aug 2021 07:39:15 +0100 Subject: [PATCH] WebDAV: Unescape XML entities when reading the item list (#8138) Without this, a file named "A & B.epub" is read as "A & B.pdf" and will 404 when fetched. --- frontend/apps/cloudstorage/webdavapi.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/apps/cloudstorage/webdavapi.lua b/frontend/apps/cloudstorage/webdavapi.lua index d61dd81a2..edd5f5330 100644 --- a/frontend/apps/cloudstorage/webdavapi.lua +++ b/frontend/apps/cloudstorage/webdavapi.lua @@ -115,7 +115,10 @@ function WebDavApi:listFolder(address, user, pass, folder_path) item_fullpath = string.sub( item_fullpath, 1, -2 ) end local is_current_dir = self:isCurrentDirectory( item_fullpath, address, path ) + local item_name = util.urlDecode( FFIUtil.basename( item_fullpath ) ) + item_name = util.htmlEntitiesToUtf8(item_name) + local is_not_collection = item:find("<[^:]*:resourcetype/>") or item:find("<[^:]*:resourcetype>")