Skip to content

Commit f0ec842

Browse files
dkd-hauserdkd-kaehm
authored andcommitted
[BUGFIX] facet URL encoding mismatch (spaces) when using urlParameterStyle=assoc
## Problem When using `faceting.urlParameterStyle = assoc`, facet links containing spaces in their values are rendered with an unresolved placeholder instead of the actual filter value: ?tx_solr[filter][materials:Material 1]=###tx_solr:filter:materials:Material 1### Values without spaces work correctly: ?tx_solr[filter][materials:Baustähle]=1 ## Root Cause In `SearchUriBuilder::buildLinkWithInMemoryCache()`, the placeholder keys for `str_replace` are computed using `urlencode()`, which encodes spaces as `+`. However, TYPO3's `UriBuilder` builds the URL template using `rawurlencode()` (RFC 3986), which encodes spaces as `%20`. The `str_replace` silently fails to find the `+`-encoded key in the `%20`-encoded template, leaving the raw `###...###` placeholder in the output. ## Fix Replace `urlencode()` with `rawurlencode()` in the second `$keys` computation (the one used for the actual `str_replace` against the URL template). This aligns the encoding with what TYPO3's `UriBuilder` produces. The first `$keys` block (passed to `BeforeCachedVariablesAreProcessedEvent`) is intentionally left unchanged to avoid side effects on existing event listeners. ## Affected versions Reproduced on EXT:solr 13.1.1 / TYPO3 13.4 with `urlParameterStyle = assoc`. --- - Use rawurlencode (spaces → %20) to match TYPO3's UriBuilder encoding. - urlencode encodes spaces as "+" which does not match "%20" in the URL template.
1 parent a3a2885 commit f0ec842

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Classes/Domain/Search/Uri/SearchUriBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ protected function buildLinkWithInMemoryCache(?int $pageUid, array $arguments):
337337
if (!str_contains($value, '###')) {
338338
return $value;
339339
}
340-
return urlencode($value);
340+
return rawurlencode($value);
341341
}, array_keys($values));
342342

343343
$uri = str_replace($keys, $values, $uriCacheTemplate);

0 commit comments

Comments
 (0)