Skip to content
Snippets Groups Projects
Commit 5fdc8849 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Removed invalid chars from attachment.

parent 5e37dfaf
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Script to start tests and to manage their results
from io import StringIO
import datetime
import os
import re
import subprocess
import sys
import uuid
......@@ -159,6 +160,7 @@ class Tester():
return 1
boundary = str(uuid.uuid4())
now = datetime.datetime.utcnow()
log_content = re.sub(r'\033\[[\d;]+m', '', log_buffer.getvalue())
mail = '''From: %(hostname)s <noreply@ubicast.eu>
To: %(recipients)s
Subject: UbiCast application test: %(status)s
......@@ -173,7 +175,7 @@ Content-transfer-encoding: utf-8
%(report)s
--%(boundary)s
Content-type: text/plain; name="%(log_name)s"
Content-type: text/plain; name="%(log_name)s"; charset=UTF-8
Content-disposition: attachment; filename="%(log_name)s"
Content-transfer-encoding: utf-8
......@@ -186,7 +188,7 @@ Content-transfer-encoding: utf-8
date=now.strftime('%Y-%m-%d %H:%M:%S'),
log_name='results_' + now.strftime('%Y-%m-%d_%H-%M-%S') + '.txt',
report=html_report,
log_content=log_buffer.getvalue(),
log_content=log_content,
)
p = subprocess.Popen(['sendmail', '-t'], stdin=subprocess.PIPE, stdout=sys.stdout.stream, stderr=sys.stderr.stream)
p.communicate(input=mail.encode('utf-8'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment