From 6bf62b16070dd9da50e9c33c0803998f91acefed Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Thu, 3 Nov 2022 15:41:32 +0000 Subject: [PATCH] [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) --- addons/website_event/static/src/snippets/options.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_event/static/src/snippets/options.js b/addons/website_event/static/src/snippets/options.js index c1f796b0e3a..eb2fd86189d 100644 --- a/addons/website_event/static/src/snippets/options.js +++ b/addons/website_event/static/src/snippets/options.js @@ -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; }, });