Export highlights: secure export filename (#14325)

This commit is contained in:
hius07 authored and GitHub committed 2025-09-15 17:02:42 +03:00
1 parent 0c917c6b3a
commit 0bea354d3b
2 files changed
+4 -2

No files matched your search

+1
View File
@@ -1006,6 +1006,7 @@ function util.getSafeFilename(str, path, limit, limit_ext)
suffix = nil
end
filename = filename:gsub("\r?\n", " "):gsub("\t", " ")
filename = util.htmlToPlainTextIfHtml(filename)
filename = filename:sub(1, limit)
-- the limit might result in broken UTF-8, which we don't want in the result
+3 -2
View File
@@ -224,8 +224,9 @@ function Exporter:exportClippings(clippings)
clipping_filename = self.settings.clipping_filename_multiple or self.default_clipping_filename_multiple
end
-- full file path without extension
clipping_filepath = clipping_dir .. "/" ..
util.getSafeFilename(self.ui.bookinfo:expandString(clipping_filename, file, timestamp), nil, nil, -1)
clipping_filename = self.ui.bookinfo:expandString(clipping_filename, file, timestamp)
clipping_filename = clipping_filename:gsub("\r?\n", "; ")
clipping_filepath = clipping_dir .. "/" .. util.getSafeFilename(clipping_filename, nil, nil, -1)
end
local export_callback = function()
UIManager:nextTick(function()