Skip to content

Commit

Permalink
Rename ERROR_MIMETYPE_UNKNOWN to ERROR_MIMETYPE_UNSUPPORTED. This is …
Browse files Browse the repository at this point in the history
…a more accurate term; an unknown mimetype will raise ERROR_MIMETYPE_DISCOVERY.
  • Loading branch information
rocodes committed Aug 23, 2024
1 parent bda7367 commit 10f52f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/securedrop_client/export_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ExportStatus(Enum):
# Print error
ERROR_PRINT = "ERROR_PRINT"
ERROR_UNPRINTABLE_TYPE = "ERROR_UNPRINTABLE_TYPE"
ERROR_MIMETYPE_UNKNOWN = "ERROR_MIMETYPE_UNKNOWN"
ERROR_MIMETYPE_UNSUPPORTED = "ERROR_MIMETYPE_UNSUPPORTED"
ERROR_MIMETYPE_DISCOVERY = "ERROR_MIMETYPE_DISCOVERY"

# New
Expand Down
4 changes: 2 additions & 2 deletions export/securedrop_export/print/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def _needs_pdf_conversion(self, filename: Path):
)
except subprocess.CalledProcessError:
logger.error(f"Could not process mimetype of {filename}")
raise ExportException(sdstatus=Status.ERROR_MIMETYPE_UNKNOWN)
raise ExportException(sdstatus=Status.ERROR_MIMETYPE_UNSUPPORTED)
# Don't print "audio/*", "video/*", or archive mimetypes
if mimetype.startswith(MIMETYPE_UNPRINTABLE) or mimetype in MIMETYPE_ARCHIVE:
logger.info(f"Unprintable file {filename}")
Expand All @@ -337,7 +337,7 @@ def _needs_pdf_conversion(self, filename: Path):
return True
else:
logger.error("Mimetype is unknown or unsupported.")
raise ExportException(sdstatus=Status.ERROR_MIMETYPE_UNKNOWN)
raise ExportException(sdstatus=Status.ERROR_MIMETYPE_UNSUPPORTED)

def _print_file(self, file_to_print: Path):
"""
Expand Down
2 changes: 1 addition & 1 deletion export/securedrop_export/print/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Status(BaseStatus):
# Print error
ERROR_PRINT = "ERROR_PRINT"
ERROR_UNPRINTABLE_TYPE = "ERROR_UNPRINTABLE_TYPE"
ERROR_MIMETYPE_UNKNOWN = "ERROR_MIMETYPE_UNKNOWN"
ERROR_MIMETYPE_UNSUPPORTED = "ERROR_MIMETYPE_UNSUPPORTED"
ERROR_MIMETYPE_DISCOVERY = "ERROR_MIMETYPE_DISCOVERY"

# New
Expand Down

0 comments on commit 10f52f6

Please sign in to comment.