summaryrefslogtreecommitdiff
path: root/addons/web_editor/controllers
diff options
context:
space:
mode:
authorSamuel Degueldre <sad@odoo.com>2020-06-16 11:03:18 +0000
committerSamuel Degueldre <sad@odoo.com>2020-06-22 13:04:44 +0000
commit5d7901a53b743e84846b19343e5ebf57b65df403 (patch)
treed44d05835526dfb4f03db64d329ca02277b9a723 /addons/web_editor/controllers
parent7abea54433d9052c61512b3696c1d8383ffe996d (diff)
[FIX] web_editor: fix traceback when clicking on website logo in edit
When clicking on an image in edit mode, the web editor attempts to find an attachment that corresponds to the image's URL. In the case of the website logo, the URL looks like it's referencing an attachment by id or xml-id, but it's actually neither. This cause a variable to never be initialized, which in turns causes a traceback when trying to access it later. This commit fixes that by always initializing attachment to None. closes odoo/odoo#53418 X-original-commit: 790e33de190392b937e21c73905db4d48cfb86aa Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/controllers')
-rw-r--r--addons/web_editor/controllers/main.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index 2b500984534..3c2f3a31c89 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -204,6 +204,7 @@ class Web_Editor(http.Controller):
"""This route is used to determine the original of an attachment so that
it can be used as a base to modify it again (crop/optimization/filters).
"""
+ attachment = None
id_match = re.search('^/web/image/([^/?]+)', src)
if id_match:
url_segment = id_match.group(1)