DiscountCodeUrl icon indicating copy to clipboard operation
DiscountCodeUrl copied to clipboard

URL parameter name may conflict with other modules

Open TerrapinSoftware opened this issue 4 years ago • 1 comments

Interesting scenario: We chose "code" for the URL parameter name. Unfortunately, if you create a new email template and load an existing template, the POST request uses the same parameter name. This causes an error message "Discount code XXX is invalid", where XXX is the ID code of the loaded template. Of course, because there is no such discount code. Triggered in FrontControllerInterface.php line 227.

Maybe is would be a good idea to limit the detection of URL parameters to GET requests, and to make sure that the area code is not "adminhtml". The short-term remedy is to use a unique name for the URL parameter, which could be a problem.

This was with Magento 2.4.2-p2 and 2.4.3.

TerrapinSoftware avatar Sep 30 '21 14:09 TerrapinSoftware

Interesting case. Thank you for catching it. Lately, I haven't had much time to work on this project, but if you'd like to submit a PR, I'd be happy to merge it in.

crankycyclops avatar Sep 30 '21 20:09 crankycyclops