mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
conversion: Detect when LibreOffice silently fails
Sometimes, LibreOffice returns with status code 0, but in reality, it fails. It doesn't create a file, and Dangerzone does not detect this. What happens next is that it fails in the next command, and throws an unrelated error. Detect that LibreOffice fails, by checking if the output file exists, after the PDF conversion.
This commit is contained in:
parent
6736fb0153
commit
bc83341d2a
1 changed files with 6 additions and 0 deletions
|
@ -185,6 +185,12 @@ class DocumentToPixels(DangerzoneConverter):
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
pdf_filename = "/tmp/input_file.pdf"
|
pdf_filename = "/tmp/input_file.pdf"
|
||||||
|
# XXX: Sometimes, LibreOffice can fail with status code 0. So, we need to
|
||||||
|
# always check if the file exists. See:
|
||||||
|
#
|
||||||
|
# https://github.com/freedomofpress/dangerzone/issues/494
|
||||||
|
if not os.path.exists(pdf_filename):
|
||||||
|
raise ValueError("Conversion to PDF with LibreOffice failed")
|
||||||
elif conversion["type"] == "convert":
|
elif conversion["type"] == "convert":
|
||||||
self.update_progress("Converting to PDF using GraphicsMagick")
|
self.update_progress("Converting to PDF using GraphicsMagick")
|
||||||
args = [
|
args = [
|
||||||
|
|
Loading…
Reference in a new issue