From 46f09b9e6c3d36fe6f7b1866c5fee42117acc1e2 Mon Sep 17 00:00:00 2001 From: Utsob Roy Date: Wed, 25 May 2022 22:14:05 +0600 Subject: [PATCH] exporter.koplugin: use safe filename fix #9130: files missing in some devices. --- plugins/exporter.koplugin/base.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/exporter.koplugin/base.lua b/plugins/exporter.koplugin/base.lua index 3fd5697c5..31e37a122 100644 --- a/plugins/exporter.koplugin/base.lua +++ b/plugins/exporter.koplugin/base.lua @@ -6,6 +6,7 @@ Each target should inherit from this class and implement *at least* an `export` @module baseexporter ]] +local getSafeFilename = require("util").getSafeFilename local BaseExporter = { clipping_dir = require("datastorage"):getDataDir() .. "/clipboard" } @@ -33,7 +34,7 @@ Export timestamp ]] function BaseExporter:getTimeStamp() local ts = self.timestamp or os.time() - return os.date("%Y-%m-%d %H:%M:%S", ts) + return os.date("%Y-%m-%d-%H-%M-%S", ts) end --[[-- @@ -79,11 +80,11 @@ File path where the exporter writes its output ]] function BaseExporter:getFilePath(t) if not self.is_remote then - return string.format("%s/%s-%s.%s", - self.clipping_dir, + local filename = string.format("%s-%s.%s", self:getTimeStamp(), #t == 1 and t[1].title or "all-books", self.extension) + return self.clipping_dir .. "/" .. getSafeFilename(filename) end end