Details
-
Bug
-
Resolution: Unresolved
-
High
-
None
-
2.5.6
-
php 7.2
ezplatform 2.5.6 with legacyBridge
Description
we have an issue using excluded_uri_prefixes and naming a content within our siteaccess the same prefix as item in excluded_uri_prefixes.
This is the Yaml Configuration :
ezpublish: system: my_siteaccess: content: tree_root: excluded_uri_prefixes: [ "/Ressources/", "/Media/" ]
Our siteaccess is level 2 below rootLocation /home and /Ressources is at the same level as our siteaccess.rootLocation /My_Siteaccess
Home Ressources My_Siteaccess Ressources-Educatives
On frontoffice, links are good in our menu (/My_Siteaccess/Ressources-Educatives) but when clicking on it, urlAliasGenerator recognise prefixes /Ressources and redirect on it, even if we add a slash at the end of /Ressources/.
Recognition is done in UrlAliasGenerator.isUriPrefixExcluded function.
cf. https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/MVC/Symfony/Routing/Generator/UrlAliasGenerator.php#L149
As you trim all slashes from item in excluded_uri_prefixes, the ending slash is not taken in account and all ressources starting with /Ressources would be redirected to /Ressources.
I solve the issue by changing :
$excludedPrefix = '/' . trim($excludedPrefix, '/');
to `ltrim`
$excludedPrefix = '/' . ltrim($excludedPrefix, '/');
and it works fine, i'm not redirected anymore on /Ressources when accessing /Ressources-Educatives
Another workaround should be :
public function isUriPrefixExcluded($uri) { $uri = preg_match('/\/$/', $uri) ? $uri : $uri . '/'; foreach ($this->excludedUriPrefixes as $excludedPrefix) { $excludedPrefix = '/' . trim($excludedPrefix, '/') . '/'; if (mb_stripos($uri, $excludedPrefix) === 0) { return true; } } return false; }
Hope it helps.
ps: i open a support.ez.no issue asap.