-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: UrlRewriteEvent: mm19inFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
Preconditions (*)
When customer opens url with trailing slash and query string like http://magento-host.com/some-url-key/?foo=bar, Magento redirects to url without trailing slash and truncates query string, so customer is redirected to http://magento-host.com/some-url-key.
- Magento version 2.2.5 or 2.2.6
- No customizations for the store, Luma + Sample Data
Steps to reproduce (*)
- Open any product or category page.
- Manually add
/?foo=bar&bar=baz
to the url and open this link
Expected result (*)
- After the page has been loaded, query string remain in url
Actual result (*)
- Query string is removed from url
Additional information
- The issue is not reproduced when we avoid using url rewrites, e.g. http://magento-host.com/catalog/product/view/id/{product-id}/?foo=bar&bar=baz, and actually there is no redirect in this case.
- The issue seems to be happen in \Magento\UrlRewrite\Model\Storage\DbStorage::doFindOneByData
$data[UrlRewrite::REQUEST_PATH] = [
rtrim($requestPath, '/'),
rtrim($requestPath, '/') . '/',
];
We are looking for both urls (with trailing slash and without it), but when verifying the result from database we do not check it.
// If request path matches the DB value or it's redirect - we can return result from DB
$canReturnResultFromDb = ($resultFromDb[UrlRewrite::REQUEST_PATH] === $requestPath || in_array((int)$resultFromDb[UrlRewrite::REDIRECT_TYPE], $redirectTypes, true));
korostii
Metadata
Metadata
Assignees
Labels
Component: UrlRewriteEvent: mm19inFixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release