Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REGRESSION] Fix CRM.url to not encode hash on WP #21020

Merged
merged 1 commit into from
Aug 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix CRM.url to not encode hash on WP
  • Loading branch information
colemanw committed Aug 5, 2021
commit 48b3a2bbfbd4f6dd3647d3d50a763d08a9b0f6d4
10 changes: 7 additions & 3 deletions js/crm.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
mode = CRM.config && CRM.config.isFrontend ? 'front' : 'back';
}
query = query || '';
var url,
frag = path.split('?');
var url, frag, hash = '';
if (path.indexOf('#') > -1) {
hash = '#' + path.split('#')[1];
path = path.split('#')[0];
}
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]);
Expand All @@ -39,7 +43,7 @@
if (frag[1]) {
url += (url.indexOf('?') < 0 ? '?' : '&') + frag[1];
}
return url;
return url + hash;
};

$.fn.crmURL = function () {
Expand Down