[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
This commit is contained in:
committed by
Thibault Delavallée
parent
15d2611003
commit
8c0bc4f4b8
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user