diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-09-21 15:30:05 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-09-21 15:30:05 +0200 |
| commit | aabbdc7339b9c2e1c10824ca2fc0a86419c46685 (patch) | |
| tree | 1f35ef9e62ef751ec3a1a61c23eb55ca6b35cfab | |
| parent | 0b4bd7a6d1ad4bcfcb650015b0c5ac31eb98de3f (diff) | |
[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
| -rw-r--r-- | addons/web/controllers/main.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 6c6c9f1fe57..c598e224bba 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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 |
