Skip to content

Commit 613363c

Browse files
committed
Try various ways of handling non-ascii names/emails in draft submissions, in order to get past the early processing to the point where we run idnits and can flag non-ascii content, instead of failing with a server 500 error.
- Legacy-Id: 12053
1 parent f6ffc1c commit 613363c

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

ietf/submit/views.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,26 @@ def upload_submission(request):
9393
email = ""
9494

9595
if email:
96-
line += u" <%s>" % email
96+
# Try various ways of handling name and email, in order to avoid
97+
# triggering a 500 error here. If the document contains non-ascii
98+
# characters, it will be flagged later by the idnits check.
99+
try:
100+
line += u" <%s>" % email
101+
except UnicodeDecodeError:
102+
try:
103+
line = line.decode('utf-8')
104+
email = email.decode('utf-8')
105+
line += u" <%s>" % email
106+
except UnicodeDecodeError:
107+
try:
108+
line = line.decode('latin-1')
109+
email = email.decode('latin-1')
110+
line += u" <%s>" % email
111+
except UnicodeDecodeError:
112+
try:
113+
line += " <%s>" % email
114+
except UnicodeDecodeError:
115+
pass
97116

98117
authors.append(line)
99118

0 commit comments

Comments
 (0)