From 346336399783c7c177832573178cb36de5e6c3ef Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 31 Oct 2022 10:03:03 +0100 Subject: [PATCH] Fix some sidebar menus are not working for apps (eg. smallpart app) --- pixelegg/js/fw_mobile.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pixelegg/js/fw_mobile.js b/pixelegg/js/fw_mobile.js index 9d3296b03e..0b7e55da51 100644 --- a/pixelegg/js/fw_mobile.js +++ b/pixelegg/js/fw_mobile.js @@ -1131,19 +1131,20 @@ import {tapAndSwipe} from "../../api/js/tapandswipe"; var href_regexp = /^javascript:([^\(]+)\((.*)?\);?$/; jQuery('#egw_fw_topmenu_items,#egw_fw_topmenu_info_items,#egw_fw_sidemenu,#egw_fw_footer').on('click','a[href^="javascript:"]',function(ev){ ev.stopPropagation(); // do NOT execute regular event, as it will violate CSP, when handler does NOT return false - var matches = this.href.match(href_regexp); + // fix for Chrome 94.0.4606.54 returning all but first single quote "'" in href as "%27" :( + var matches = this.href.replaceAll(/%27/g, "'").replaceAll(/%22/g, '"').match(href_regexp); var args = []; if (matches.length > 1 && matches[2] !== undefined) { try { - args = JSON.parse('['+decodeURI(matches[2])+']'); + args = JSON.parse('['+matches[2]+']'); } - catch(e) { // deal with '-encloded strings (JSON allows only ") + catch(e) { // deal with '-enclosed strings (JSON allows only ") args = JSON.parse('['+matches[2].replace(/','/g, '","').replace(/((^|,)'|'(,|$))/g, '$2"$3')+']'); } } args.unshift(matches[1]); - et2_call.apply(this, args); + if (matches[1] !== 'void') et2_call.apply(this, args); return false; // IE11 seems to require this, ev.stopPropagation() does NOT stop link from being executed }); });