Skip to content

Commit

Permalink
Merge pull request #60 from CybercentreCanada/js_timeout
Browse files Browse the repository at this point in the history
Js timeout
  • Loading branch information
cccs-rs authored May 18, 2023
2 parents bfd07b3 + f2f11d7 commit 08f4eb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion document_preview/document_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class DocumentPreview(ServiceBase):
def __init__(self, config=None):
super(DocumentPreview, self).__init__(config)
self.has_internet_access = get_service_manifest().get('docker_config', {}).get('allow_internet_access', False)
self.log.info(f"Service is configured {'with' if self.has_internet_access else 'without'} internet access")

def start(self):
self.log.debug("Document preview service started")
Expand Down Expand Up @@ -62,7 +63,7 @@ def render_documents(self, request: Request, max_pages=1):
# Convert MSG to EML where applicable
if request.file_type == 'document/office/email':
with tempfile.NamedTemporaryFile() as tmp:
subprocess.run(['msgconvert', '-outfile', tmp.name, request.file_path])
subprocess.run(['msgconvert', '-outfile', tmp.name, request.file_path], capture_output=True)
tmp.seek(0)
file_contents = tmp.read()
# Render EML as PNG
Expand Down
2 changes: 1 addition & 1 deletion document_preview/helper/emlrender.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def processEml(data, output_dir, logger, load_ext_images=False, load_images=Fals

imgkitOptions = {'load-error-handling': 'skip'}
if not load_ext_images:
imgkitOptions.update({'no-images': None})
imgkitOptions.update({'no-images': None, 'disable-javascript': None})
# imgkitOptions.update({ 'quiet': None })
imagesList = []

Expand Down

0 comments on commit 08f4eb0

Please sign in to comment.