Skip to content

Commit 73208fd

Browse files
committed
add optenum for output ext
Signed-off-by: RAMELLA Sebastien <[email protected]>
1 parent d474d9b commit 73208fd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/auxiliary/fileformat/maldoc_in_pdf_polyglot.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def initialize(info = {})
4343
[
4444
OptPath.new('FILENAME', [true, 'The input MHT filename with macro embedded']),
4545
OptPath.new('INJECTED_PDF', [false, 'The input PDF filename to inject in (optional)']),
46-
OptString.new('MESSAGE_PDF', [false, 'The message to display in the local PDF template (if INJECTED_PDF is NOT used)', 'You must open this document in Microsoft Word'])
46+
OptString.new('MESSAGE_PDF', [false, 'The message to display in the local PDF template (if INJECTED_PDF is NOT used)', 'You must open this document in Microsoft Word']),
47+
OptEnum.new('OUTPUT_EXT', [true, 'The output file extension', '.doc', ['.doc', '.rtf']])
4748
]
4849
)
4950
end
@@ -117,7 +118,7 @@ def create_pdf(mht)
117118

118119
# saving the file
119120
ltype = "auxiliary.fileformat.#{shortname}"
120-
fname = File.basename(datastore['FILENAME']).sub(File.extname(datastore['FILENAME']), '.doc')
121+
fname = File.basename(datastore['FILENAME']).sub(File.extname(datastore['FILENAME']), datastore['OUTPUT_EXT'])
121122
path = store_local(ltype, nil, pdf, fname)
122123

123124
print_good("The file '#{fname}' is stored at '#{path}'")
@@ -183,7 +184,7 @@ def inject_pdf(pdf_path, mht)
183184

184185
# saving the file
185186
ltype = "auxiliary.fileformat.#{shortname}"
186-
fname = File.basename(datastore['FILENAME']).sub(File.extname(datastore['FILENAME']), '.doc')
187+
fname = File.basename(datastore['FILENAME']).sub(File.extname(datastore['FILENAME']), datastore['OUTPUT_EXT'])
187188
path = store_local(ltype, nil, pdf, fname)
188189

189190
print_good("The file '#{fname}' is stored at '#{path}'")

0 commit comments

Comments
 (0)