diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py index 87db5e7b377..e85a678f54e 100644 --- a/addons/web_editor/controllers/main.py +++ b/addons/web_editor/controllers/main.py @@ -531,13 +531,20 @@ class Web_Editor(http.Controller): svg = file.read() user_colors = [] - for key, color in kwargs.items(): - match = re.match('^c([1-5])$', key) - if match: + for key, value in kwargs.items(): + colorMatch = re.match('^c([1-5])$', key) + if colorMatch: # Check that color is hex or rgb(a) to prevent arbitrary injection - if not re.match(r'(?i)^#[0-9A-F]{6,8}$|^rgba?\(\d{1,3},\d{1,3},\d{1,3}(?:,[0-9.]{1,4})?\)$', color.replace(' ', '')): + if not re.match(r'(?i)^#[0-9A-F]{6,8}$|^rgba?\(\d{1,3},\d{1,3},\d{1,3}(?:,[0-9.]{1,4})?\)$', value.replace(' ', '')): raise werkzeug.exceptions.BadRequest() - user_colors.append([tools.html_escape(color), match.group(1)]) + user_colors.append([tools.html_escape(value), colorMatch.group(1)]) + elif key == 'flip': + if value == 'x': + svg = svg.replace(' + viewBox="0 0 1400 244.7" xml:space="preserve">