From 5b075930c84a2f1fcf797482826c34e1827763c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20K=C3=A4hm?= Date: Mon, 12 Jun 2023 10:03:42 +0200 Subject: [PATCH] [BUGFIX] Hierarchy facet items containing dashes cannot be unset If you try to apply the hierarchy facet to a path of UUIDs instead of integers the facet can be selected, but not unselected anymore. This happens because the HierarchyFacetParser assumes that every value containing a dash is one that already contains the depth param. Which is not the case when dealing with uuids like /228d03bf-de44-4fcd-91fd-6ab05175fefc/901d43ca-28cf-4dbd-983d-ac96a0930530/a3f94d07-30fe-4ad1-a0cf-b5082db3aa94/. This fix introduces a check that matches the value against the depth param pattern. by @tmaroschik Replaces: #3070 --- .../Facets/OptionBased/Hierarchy/HierarchyFacetParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php index 9b64eb6e5c..4394d35da5 100644 --- a/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php +++ b/Classes/Domain/Search/ResultSet/Facets/OptionBased/Hierarchy/HierarchyFacetParser.php @@ -128,7 +128,7 @@ protected function getActiveFacetValuesFromRequest(SearchResultSet $resultSet, s foreach ($values as $valueFromRequest) { // Attach the 'depth' param again to the value - if (!str_contains($valueFromRequest, '-')) { + if (preg_match('/^[0-9]+-/', $valueFromRequest)) { $valueFromRequest = HierarchyTool::substituteSlashes($valueFromRequest); $valueFromRequest = trim($valueFromRequest, '/'); $valueFromRequest = (count(explode('/', $valueFromRequest)) - 1) . '-' . $valueFromRequest . '/';