Skip to content

Commit e14fed2

Browse files
committed
Fixed #17147
[ci skip]
1 parent 19b37aa commit e14fed2

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Fixed a bug where static relational field inputs weren’t showing the related elements’ hierarchy. ([#17127](https://github.com/craftcms/cms/issues/17127))
66
- Fixed a bug where some system screens shown on the front end were sent without no-cache headers. ([#17129](https://github.com/craftcms/cms/issues/17129))
77
- Fixed a bug where the default `notificationDuration` value per the `accessibilityDefaults` config setting wasn’t being respected for users who hadn’t saved their preferences yet.
8+
- Fixed a bug where control panel JavaScript-generated URLs weren’t formatted correctly if the `omitScriptNameInUrls` and `usePathInfo` config settings were both disabled. ([#17147](https://github.com/craftcms/cms/issues/17147))
89

910
## 4.15.0.2 - 2025-04-17
1011

src/web/assets/cp/dist/cp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/dist/cp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/src/js/Craft.js

+12-14
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,9 @@ $.extend(Craft, {
451451
if (path.search('://') !== -1 || path[0] === '/') {
452452
return (
453453
path +
454-
(!$.isEmptyObject(params) ? `?${$.param(params)}` : '') +
454+
(!$.isEmptyObject(params)
455+
? `?${decodeURIComponent($.param(params))}`
456+
: '') +
455457
(anchor ? `#${anchor}` : '')
456458
);
457459
}
@@ -483,14 +485,13 @@ $.extend(Craft, {
483485

484486
// Does the base URL already have a query string?
485487
qsPos = url.indexOf('?');
488+
let baseParams;
486489
if (qsPos !== -1) {
487-
params = $.extend(
488-
Object.fromEntries(
489-
new URLSearchParams(url.substring(qsPos + 1)).entries()
490-
),
491-
params
490+
baseParams = Object.fromEntries(
491+
new URLSearchParams(url.substring(qsPos + 1)).entries()
492492
);
493493
url = url.substring(0, qsPos);
494+
params = Object.assign({}, baseParams, params);
494495
}
495496

496497
if (!Craft.omitScriptNameInUrls && path) {
@@ -501,13 +502,10 @@ $.extend(Craft, {
501502
}
502503
} else {
503504
// Move the path into the query string params
504-
505-
// Is the path param already set?
506-
if (typeof params[Craft.pathParam] !== 'undefined') {
507-
let basePath = params[Craft.pathParam].trimEnd();
508-
path = basePath + (path ? '/' + path : '');
505+
if (baseParams && baseParams[Craft.pathParam] !== undefined) {
506+
path =
507+
baseParams[Craft.pathParam].trimEnd() + (path ? '/' + path : '');
509508
}
510-
511509
params[Craft.pathParam] = path;
512510
path = null;
513511
}
@@ -518,7 +516,7 @@ $.extend(Craft, {
518516
}
519517

520518
if (!$.isEmptyObject(params)) {
521-
url += `?${$.param(params)}`;
519+
url += `?${decodeURIComponent($.param(params))}`;
522520
}
523521

524522
if (anchor) {
@@ -635,7 +633,7 @@ $.extend(Craft, {
635633
if (document.location.search) {
636634
const params = Object.fromEntries(new URLSearchParams(qs).entries());
637635
delete params[pageParam];
638-
qs = $.param(params);
636+
qs = decodeURIComponent($.param(params));
639637
}
640638
if (page !== 1) {
641639
qs += (qs !== '' ? '&' : '') + `${pageParam}=${page}`;

0 commit comments

Comments
 (0)