diff --git a/frontend/util.lua b/frontend/util.lua index 65e306009..c1e97502f 100644 --- a/frontend/util.lua +++ b/frontend/util.lua @@ -954,7 +954,7 @@ end -- / poses a problem. ---- @string str filename ---- @treturn string sanitized filename -local function replaceAllInvalidChars(str) +function util.replaceAllInvalidChars(str) if str then str = str:gsub('[\\/:*?"<>|]', '_') str = str:gsub("[.%s]+$", "") @@ -984,7 +984,7 @@ If an optional path is provided, @{util.getFilesystemType}() will be used to det ---- @treturn string safe filename function util.getSafeFilename(str, path, limit, limit_ext) local filename, suffix = util.splitFileNameSuffix(str) - local replaceFunc = replaceAllInvalidChars + local replaceFunc = util.replaceAllInvalidChars local safe_filename -- VFAT supports a maximum of 255 UCS-2 characters, although it's probably treated as UTF-16 by Windows -- default to a slightly lower limit just in case diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index f4b808577..46882a5cd 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -1458,7 +1458,7 @@ function OPDSBrowser:getFileName(item) if self.root_catalog_raw_names then filename = nil end - return filename, filename_orig + return util.replaceAllInvalidChars(filename), util.replaceAllInvalidChars(filename_orig) end function OPDSBrowser:updateFieldInCatalog(item, name, value)