[fix, chore] Abstract filename logic in util.getSafeFilename() (#5026)

Fixes https://github.com/koreader/koreader/issues/5025

The OPDS browser was doing some fancier stuff in a way that should be abstracted away in util (because it applies anywhere files will be saved):

eace8d25c1/frontend/ui/widget/opdsbrowser.lua (L482-L491)
This commit is contained in:
Frans de Jonge
2019-05-14 19:10:41 +02:00
committed by GitHub
parent de75f6bfa3
commit 8815cbe07a
6 changed files with 57 additions and 24 deletions

View File

@@ -616,7 +616,7 @@ function ReaderLink:onGoToExternalLink(link_url)
-- wikipedia page saved as epub, full of wikipedia links, it's
-- too easy to click on links when wanting to change page...)
-- But first check if this wikipedia article has been saved as EPUB
local epub_filename = util.replaceInvalidChars(wiki_page:gsub("_", " ")) .. "."..string.upper(wiki_lang)..".epub"
local epub_filename = util.getSafeFilename(wiki_page:gsub("_", " ")) .. "."..string.upper(wiki_lang)..".epub"
local epub_fullpath
-- either in current book directory
local last_file = G_reader_settings:readSetting("lastfile")