Julien (jula) cf187ab43e [FIX] website_form: prevent crashing while parsing python dict in JS
__Description of the issue:__
- The `replace` method in JS only replace the first occurrence of a
string (unless `g` flag is used in the regex)
- There could be an apostrophe (`‘`) in a string value which would be
replaced by a quote (`“`)
- There could be “None”, “False” in a string value which would be
replaced too
- “True” is not taken into account

__Description of the fix:__
Those regex are meant to deal with more edge cases when transforming a
python dict to a JSON in JS. However there are still ways it could go
wrong. For the forward port in master, it could be a good idea to
consider converting dictionnaries directly in the backend using the
`json` python library.

__Steps to reproduce the issue:__
1. Edit the view `website.contactus`
(If `website_crm` is installed, either uninstall it or disable the
`website_crm.contactus_form` view)
2. At line 5, change the attribute `t-att-data-values` to a more
complicated dict like:
```
"{'email_to': res_company.email, 'name': 'Alice True', 'age': None, 'active': True, 'attr1': None , 'attr2': False , 'attr3': 'let\'s go'}"
```
3. Go to `/contactus` on the website
↳ Traceback

opw-3328690
task-3340946

closes odoo/odoo#128127

X-original-commit: 5360e10dcd89bdbae6d01a0f6597571c8592301f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-07-12 13:58:06 +02:00
2023-07-12 11:19:58 +02:00
…
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%