Closed pr-apes closed 1 year ago
Thank you very much for the patch, it will be included in the next version.
I have slightly edited the code since filename is an optional parameter and might be nil. Also added a warning for the user.
src/lua/publisher/commands.lua | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lua/publisher/commands.lua b/src/lua/publisher/commands.lua
index d57d2db5..0a146d85 100644
--- a/src/lua/publisher/commands.lua
+++ b/src/lua/publisher/commands.lua
@@ -196,6 +196,11 @@ function commands.attachfile( layoutxml,dataxml )
return
end
local stat = lfs.attributes(path)
+ local filename_extension = filename:match("^.*%.(.+)$"):lower()
+ if destfilename:match("^.*%.(.+)$") == nil then
+ warning("AttachFile: name attribute has no file extension, take from source.")
+ destfilename = string.format("%s.%s",destfilename,filename_extension)
+ end
modificationtime = stat.modification
local zugferdfile = io.open(path)
Many thanks for the improvements.
I didn't realize that filename
could be an optional parameter.
when
name
is missing the extension