[FIX] website_event: fix a regex unsupported in Safari

Commit [1] added a regular expression that looks behind to ensure a `-`
is present without capturing it. Unfortunately, the Positive Look Behind
regex (?<=...) is unsupported by Safari as of now (16.1, see [2]).

This commit replaces the regex by removing the '-' after capturing it.

Steps to reproduce:
- Use Safari
- Install website_event
- Try to edit any page with website
- "Invalid group specifier name" error appears

[1]: https://github.com/odoo/odoo/commit/5f1f082dbe268522f8fc7e63ad5f564b25020a22
[2]: https://caniuse.com/js-regexp-lookbehind

opw-3049537
opw-3023128
opw-3023329

closes odoo/odoo#105076

X-original-commit: 08413daa7b62539f86110575f1835d6db271ea10
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Arthur Detroux (ard)
2022-11-06 15:15:55 +01:00
parent 50b8c4b270
commit 6bf62b1607
@@ -62,7 +62,7 @@ options.registry.WebsiteEvent = options.Class.extend({
* @private
*/
_getEventObjectId() {
const objectIds = this.currentWebsiteUrl.match(/(?<=-)\d+(?![-\w\d])/);
return parseInt(objectIds[0]) | 0;
const objectIds = this.currentWebsiteUrl.match(/-\d+(?![-\w\d])/);
return parseInt(objectIds[0].replace('-', '')) | 0;
},
});