diff options
| author | Patrick Hoste <pko@odoo.com> | 2020-06-04 12:13:16 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-08-06 15:07:37 +0000 |
| commit | 8c0bc4f4b81db820fe984ebc4d209894a8041f39 (patch) | |
| tree | 2015e15b1605e1ceb5ecf15c46fdc9e74f9050a4 /addons | |
| parent | 15d26110033c2cc1eb23f8c37f2a794e69631746 (diff) | |
[FIX] web: fix image widget when record name is ..
PURPOSE
Before this commit, when you used the 'image' widget when the record name was
``..`` (double dots) it couldn't retrieve the image since the double dots was
decoded as the parent directory shortcut. After this commit, the double dots
will be replaced by -- with the downside to loose the true record name.
SPECIFICATIONS
Replace the .. (double dots) with -- in the filename.
Using .. may seem like a strange use case but if you actually try to find
a partner called ".." in a production database, you might be surprised ...
LINKS
Task ID-2241513 (eLearning onboarding and testing)
PR #55567
X-original-commit: dcb7a924c36cd3f3aeef891ddd8830bd66322025
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/models/ir_qweb.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/web/models/ir_qweb.py b/addons/web/models/ir_qweb.py index 4ffab27bd5e..875899f7d57 100644 --- a/addons/web/models/ir_qweb.py +++ b/addons/web/models/ir_qweb.py @@ -52,7 +52,7 @@ class Image(models.AbstractModel): filename = options['filename'] else: filename = record.display_name - filename = filename.replace('/', '-').replace('\\', '-') + filename = filename.replace('/', '-').replace('\\', '-').replace('..', '--') src = '/web/image/%s/%s/%s%s/%s?unique=%s' % (record._name, record.id, options.get('preview_image', field_name), max_size, url_quote(filename), sha) |
