Fix psgdpr menu URL query separator#242
Conversation
|
Hello @Codencode! This is your first pull request on psgdpr repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
|
Thank you for this PR. I had the issue in 9.1 and it works fine. |
Hlavtox
left a comment
There was a problem hiding this comment.
AI suggested that duplicate parameters can occur. :-)
What about this?
function setQueryParameter(url, key, value) {
const u = new URL(url, window.location.origin);
u.searchParams.set(key, value);
return u.toString();
}
window.history.pushState({}, "", setQueryParameter(moduleAdminLink, "page", item));|
This pull request seems to contain new translation strings. I have summarized them below to ease up review:
(Note: this is an automated message, but answering it will reach a real human) |
Ok, I made the change. I also created an additional commit, because I realized that we also needed to modify the dataConfig.tpl and dataConsent.tpl files, in addition to the Psgdpr::getTokenFromAdminLink() method, to verify that the admin tokens were active. |
deae3c1 to
2d69163
Compare
ping @Hlavtox |
|
@Hlavtox, you're actually right, the links can be retrieved directly by passing the 'page' parameter. I hadn't considered it because I didn't want to change the current logic. I've made the changes — do you think it's okay now |
Hlavtox
left a comment
There was a problem hiding this comment.
Paolo “Il Cleaner del Codice” Cunti 🚀
There was a problem hiding this comment.
Hi @Codencode
Thank you for your PR, I tested it and it seems to works as you can see :
Capture.video.du.2026-05-29.10-41-42.mp4
Tested on :
9.1.x
9.0.3
The PR seems to works as expected, It'll be QA ✔️ when the PHP test 'll be green
Thank you
|
@Hlavtox @PrestaShop/committers |
Previously, the
pagequery parameter was always appended using&, which produced an invalid URL when no query string was present yet.Example:
- before:
/admin/improve/modules/manage/action/configure/psgdpr&page=dataConfig- after:
/admin/improve/modules/manage/action/configure/psgdpr?page=dataConfigWhen a token is present, the existing behavior is preserved:
-
/admin/improve/modules/manage/action/configure/psgdpr?_token=xxx&page=dataConfigIn addition to fixing the query separator for module configuration URLs, it also:
- fixes
dataConsent.tplanddataConfig.tplform actions so they use the proper query separator depending on whether the base admin URL already contains a query string- makes
Psgdpr::getTokenFromAdminLink()return an empty string whenTokenInUrls::isDisabled()is enabled, to avoid relying on a token that is not present in the URL2. Disable BO tokens
3. Open a module
4. Submit the configuration page form