Skip to content

Commit

Permalink
[BUGFIX] Hierarchy facet items containing dashes cannot be unset
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dkd-kaehm committed Dec 6, 2023
1 parent eb7d2e6 commit 5b07593
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '/';
Expand Down

0 comments on commit 5b07593

Please sign in to comment.