From 807354b401018f40a788c327fd86eb504776d2d7 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Wed, 27 Mar 2024 18:14:49 +0100 Subject: [PATCH] Allows paths with non-ending '/' --- Plugin/App/Request/StorePathInfoValidator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugin/App/Request/StorePathInfoValidator.php b/Plugin/App/Request/StorePathInfoValidator.php index 12965fa..1e3dbb5 100644 --- a/Plugin/App/Request/StorePathInfoValidator.php +++ b/Plugin/App/Request/StorePathInfoValidator.php @@ -12,6 +12,8 @@ use Magento\Store\Model\Store; use Opengento\StorePathUrl\Model\Config; +use function explode; + class StorePathInfoValidator { public function __construct( @@ -22,7 +24,7 @@ public function __construct( public function beforeGetValidStoreCode(Subject $subject, Http $request, string $pathInfo = ''): array { if ($pathInfo !== '' && $this->config->isEnabled()) { - $uri = $request->getUriString(); + $uri = explode('?', $request->getUriString())[0] . '/'; /** @var Store $store */ foreach ($this->storeRepository->getList() as $store) { if ($store->getId() && str_starts_with($uri, $store->getBaseUrl())) {