diff --git a/dangerzone/conversion/errors.py b/dangerzone/conversion/errors.py index 9ba2620..550b1e2 100644 --- a/dangerzone/conversion/errors.py +++ b/dangerzone/conversion/errors.py @@ -124,6 +124,15 @@ class ServerOutOfTempSpaceError(OutOfSpaceError): error_message = "The isolated environment where the document conversion take space ran out of space" +class ClientOutOfTMPSpaceError(OutOfSpaceError): + """The client ran out of space""" + + error_code = ERROR_SHIFT + 72 + error_message = ( + "You computer ran out of temporary storage space during the document conversion" + ) + + class UnexpectedConversionError(PDFtoPPMException): error_code = ERROR_SHIFT + 100 error_message = "Some unexpected error occurred while converting the document" diff --git a/dangerzone/isolation_provider/qubes.py b/dangerzone/isolation_provider/qubes.py index e2cfc43..d7bdebc 100644 --- a/dangerzone/isolation_provider/qubes.py +++ b/dangerzone/isolation_provider/qubes.py @@ -135,14 +135,16 @@ class Qubes(IsolationProvider): timeout=sw.remaining, ) - # Wrapper code - with open(f"/tmp/dangerzone/page-{page}.width", "w") as f_width: - f_width.write(str(width)) - with open(f"/tmp/dangerzone/page-{page}.height", "w") as f_height: - f_height.write(str(height)) - with open(f"/tmp/dangerzone/page-{page}.rgb", "wb") as f_rgb: - f_rgb.write(untrusted_pixels) - + try: + # Wrapper code + with open(f"/tmp/dangerzone/page-{page}.width", "w") as f_width: + f_width.write(str(width)) + with open(f"/tmp/dangerzone/page-{page}.height", "w") as f_height: + f_height.write(str(height)) + with open(f"/tmp/dangerzone/page-{page}.rgb", "wb") as f_rgb: + f_rgb.write(untrusted_pixels) + except OSError: + raise errors.ClientOutOfTMPSpaceError() percentage += percentage_per_page text = f"Converting page {page}/{n_pages} to pixels"