From: Matthew Wire Date: Tue, 10 May 2022 15:41:20 +0000 (+0100) Subject: Use a more unique placeholder url path for CiviCRM AJAX requests X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6ef71ec82ac649f1daefd577a8f31f4fdd348e44;p=civicrm-core.git Use a more unique placeholder url path for CiviCRM AJAX requests --- diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 1a4983cc3a..4cb20cd03e 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -31,10 +31,10 @@ // Remove basepage as it can be changed on some CMS eg. WordPress frontend. frag[0] = frag[0].replace('civicrm/', '/'); // Encode url path only if slashes in placeholder were also encoded - if (tplURL[mode].indexOf('/placeholder-url-path') >= 0) { - url = tplURL[mode].replace('/placeholder-url-path', frag[0]); + if (tplURL[mode].indexOf('/crmajax-placeholder-url-path') >= 0) { + url = tplURL[mode].replace('/crmajax-placeholder-url-path', frag[0]); } else { - url = tplURL[mode].replace('%2Fplaceholder-url-path', encodeURIComponent(frag[0])); + url = tplURL[mode].replace('%2Fcrmajax-placeholder-url-path', encodeURIComponent(frag[0])); } if (_.isEmpty(query)) { diff --git a/templates/CRM/common/l10n.js.tpl b/templates/CRM/common/l10n.js.tpl index 7e804f5568..67f69ada05 100644 --- a/templates/CRM/common/l10n.js.tpl +++ b/templates/CRM/common/l10n.js.tpl @@ -29,7 +29,7 @@ CRM.config.entityRef = $.extend({ldelim}{rdelim}, {$entityRef|@json_encode}, CRM.config.entityRef || {ldelim}{rdelim}); // Initialize CRM.url and CRM.formatMoney - CRM.url({ldelim}back: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim}); + CRM.url({ldelim}back: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fb=1}', front: '{crmURL p="civicrm/crmajax-placeholder-url-path" q="civicrm-placeholder-url-query=1" h=0 fe=1}'{rdelim}); CRM.formatMoney('init', false, {$moneyFormat|@json_encode}); // Localize select2 diff --git a/tests/karma/unit/crmMailingSpec.js b/tests/karma/unit/crmMailingSpec.js index 6c09291182..97a9f08ace 100644 --- a/tests/karma/unit/crmMailingSpec.js +++ b/tests/karma/unit/crmMailingSpec.js @@ -17,7 +17,7 @@ describe('crmMailing', function() { $provide.value('crmNavigator', navigator); }); inject(['crmLegacy', function(crmLegacy) { - crmLegacy.url({back: '/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1', front: '/civicrm/placeholder-url-path?civicrm-placeholder-url-query=1'}); + crmLegacy.url({back: '/civicrm/crmajax-placeholder-url-path?civicrm-placeholder-url-query=1', front: '/civicrm/crmajax-placeholder-url-path?civicrm-placeholder-url-query=1'}); }]); inject(['$controller', function($controller) { ctrl = $controller('ListMailingsCtrl', {});