X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.ajax.js;h=aabfd28f3aaf6b55edaf3d9d651258039ee65b8f;hb=f72dc3d8c7ba1c0441da976efc65bb493990141a;hp=757ebef0633562eefce72b077e916af2d5b9f155;hpb=f8b44070324fc9ed6ab55573c4995a879bfbbabc;p=civicrm-core.git diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 757ebef063..aabfd28f3a 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -22,14 +22,19 @@ mode = CRM.config && CRM.config.isFrontend ? 'front' : 'back'; } query = query || ''; - var frag = path.split('?'); - var url = tplURL[mode].replace("civicrm-placeholder-url-path", frag[0]); + var url, + frag = path.split('?'); + // Encode url path only if slashes in placeholder were also encoded + if (tplURL[mode].indexOf('civicrm/placeholder-url-path') >= 0) { + url = tplURL[mode].replace('civicrm/placeholder-url-path', frag[0]); + } else { + url = tplURL[mode].replace('civicrm%2Fplaceholder-url-path', encodeURIComponent(frag[0])); + } - if (!query) { + if (_.isEmpty(query)) { url = url.replace(/[?&]civicrm-placeholder-url-query=1/, ''); - } - else { - url = url.replace("civicrm-placeholder-url-query=1", typeof query === 'string' ? query : $.param(query)); + } else { + url = url.replace('civicrm-placeholder-url-query=1', typeof query === 'string' ? query : $.param(query)); } if (frag[1]) { url += (url.indexOf('?') < 0 ? '?' : '&') + frag[1];