[FIX] web: Safari, download of attachments with accents
The structure `filename*=UTF-8` works in Safari, from release 6.2 (which is set as version 537 in the user_agent version). This structure has the advantage to handle the UTF-8 encoding, and therefore special characters, such as accents. Therefore, from this Safari release, we use the same format than other browser. For older releases, we use the format `filename=`, without UTF-8, ASCII encoded, replacing special characters by `?`. opw-649863
This commit is contained in:
parent
0b4bd7a6d1
commit
aabbdc7339
|
@ -451,8 +451,8 @@ def content_disposition(filename):
|
|||
version = int((request.httprequest.user_agent.version or '0').split('.')[0])
|
||||
if browser == 'msie' and version < 9:
|
||||
return "attachment; filename=%s" % escaped
|
||||
elif browser == 'safari':
|
||||
return u"attachment; filename=%s" % filename
|
||||
elif browser == 'safari' and version < 537:
|
||||
return u"attachment; filename=%s" % filename.encode('ascii', 'replace')
|
||||
else:
|
||||
return "attachment; filename*=UTF-8''%s" % escaped
|
||||
|
||||
|
|
Loading…
Reference in New Issue