netgen / TagsBundle

Netgen Tags Bundle is an eZ Platform bundle for taxonomy management and easier classification of content, providing more functionality for tagging content than ezkeyword field type included in eZ Platform kernel.
https://netgen.io
GNU General Public License v2.0
48 stars 43 forks source link

Change word separator char in url from + to %20 for Ibexa DXP 3.3.12 #144

Closed kh09211 closed 2 years ago

kh09211 commented 2 years ago

Hello, we have recently encountered a situation when upgrading to Ibexa 3.3.12 where it appears that Ibexa has changed from using %20 in it's URL to plus signs. We were not sure the best way to rectify this, so we made a patch to the netgen tag router, and installed it with composer patches package. This works, but is there a better way?

--- tagsbundle/bundle/Routing/TagRouterOriginal.php 2021-12-07 22:40:32.996776616 +0000
+++ tagsbundle/bundle/Routing/TagRouter.php 2021-12-07 22:40:53.085558199 +0000
@@ -85,7 +85,7 @@
         }

         $requestedPath = $this->removePathPrefix($requestedPath, $pathPrefix);
-        $requestedPath = trim($requestedPath, '/');
+        $requestedPath = trim(str_replace('+', ' ', $requestedPath), '/');

         if ($requestedPath === '') {
             throw new ResourceNotFoundException('Route not found');
emodric commented 2 years ago

Well, not really. You either do it as you did, or replace the TagRouter class completely with a compiler pass.

kh09211 commented 2 years ago

Thank you Emodric for the reply!