diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index e61a526772..087849daeb 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Escape arguments of report convert command (issue15035) * Escape title and text when rendering HTML editor (issue15032) Version 8.0.10 - 2026-09-16 diff --git a/trytond/trytond/report/report.py b/trytond/trytond/report/report.py index 62390b6ed4..2d77b07a7a 100644 --- a/trytond/trytond/report/report.py +++ b/trytond/trytond/report/report.py @@ -8,6 +8,7 @@ import mimetypes import operator import os import pathlib +import shlex import shutil import subprocess import tempfile @@ -449,20 +450,20 @@ class Report(URLMixin, PoolBase): '--convert-to "%(output_extension)s" ' '--outdir "%(directory)s" ' '"%(input_path)s"') - cmd %= { - 'directory': directory, - 'input_format': input_format, - 'input_extension': input_extension, - 'input_path': input_path, - 'output_format': output_format, - 'output_extension': output_extension, - 'output_path': output_path, - } + args = map(lambda s: s % { + 'directory': directory, + 'input_format': input_format, + 'input_extension': input_extension, + 'input_path': input_path, + 'output_format': output_format, + 'output_extension': output_extension, + 'output_path': output_path, + }, shlex.split(cmd)) for count in range(retry, -1, -1): if count != retry: time.sleep(0.02 * (retry - count)) try: - subprocess.check_call(cmd, timeout=timeout, shell=True) + subprocess.run(args, timeout=timeout, check=True) except subprocess.CalledProcessError: if count: continue