-
-
Notifications
You must be signed in to change notification settings - Fork 242
Description
Hi,
Current Behavior
When using the ICS export on a speaker page on the schedule, if the speaker has non latin1 letters in his name, pretalx will return Internal Server Error.
Expected Behavior
The ICS export should be generated and downloadable.
Steps to Reproduce
- Go to a public speaker page, of a speaker with non latin1 letters.
- Try to download the ical.
Context
I think that the issue comes from this line:
| ] = f'attachment; filename="{request.event.slug}-{speaker_name}.ics"' |
It defines a HTTP header containing the speaker name, which can contain non latin1 letters.
I encountered the issue with Gunicorn 19.9.0, which was more restrictive and required ASCII-only letters. I had issues with the following speaker: https://pretalx.jdll.org/jdll2019/speaker/PE93CF/:
[2019-12-16 19:28:09 +0000] [8407] [ERROR] Error handling request /jdll2019/speaker/PE93CF/talks.ics
Traceback (most recent call last):
File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/workers/sync.py", line 182, in handle_request
resp.write(item)
File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/http/wsgi.py", line 333, in write
self.send_headers()
File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/http/wsgi.py", line 329, in send_headers
util.write(self.sock, util.to_bytestring(header_str, "ascii"))
File "/var/pretalx/.local/lib/python3.6/site-packages/gunicorn/util.py", line 507, in to_bytestring
return value.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 180: ordinal not in range(128)
This has been changed in this commit: benoitc/gunicorn@879651b. Now Gunicorn require latin1-only letters, which is less restrictive. With Gunicorn 20.0.4, I cannot reproduce the error as we don't have speakers with non-latin1 letters.
It seems that this instance uses an older version of Gunicorn, which requires ASCII-only letters: https://cfp.verschwoerhaus.de/wdwe19/speaker/EJYX78/.
This issue is less problematic when using Latin alphabet with a recent Gunicorn version, but can still be inconvenient for non Latin letters.
One solution could be replacing the speaker name by the speaker code in the filename.
Your Environment
- Version used: 1.0.4
- Environment name and version (e.g. Chrome 39, python 3.5): Python 3.6.9
- Operating System and version (desktop or mobile): Ubuntu 18.04.3
- Link to your instance, if in production: https://pretalx.jdll.org