Hello,
After some tests with Facets Ajax block feature, i find a bad practice.
The path given in parameter of inbound and outbound processors must to be clean (without query parameters).
The path built with "facet_link" parameter is directly given in paramters of processInboud method in FacetBlockAjaxController::ajaxFacetBlockView() :
public function ajaxFacetBlockView(Request $request) {
...
$path = $request->request->get('facet_link');
...
$processed = $this->pathProcessor->processInbound($path, $new_request);
...
Query parameters are available in the "$new_request" variable and should not be in "$path".
Thanks to clear "$path" variable before "processInbound()" call :
$parsed_path = parse_url($path);
$processed = $this->pathProcessor->processInbound($parsed_path['path'], $new_request);
EDIT: Add patch proposal
Comments
Comment #2
s3b0un3tComment #3
karlsheaThis is breaking facets_summary
ResetFacetsProcessor::build(). The $url there built from$facets_summary->getFacetSource()->getPath()ends up getting a full URL instead of just a path, which breaksUrl::fromUserInput().This probably explains a lot of the 500 errors that people are seeing from some Ajax requests.
Comment #4
karlsheaComment #5
karlsheaComment #6
mglamanBumping to major. It's causing 500 errors.
Comment #7
mglamanThis stopped our page from having 500 errors with Views + AJAX
Comment #8
borisson_Committed/pushed, thanks!
Comment #10
berdirThis was closed, but I don't see the commit anywhere. I just updated to 2.0.1 and the patch still applies. Looks like it wasn't pushed?
Comment #11
mkalkbrennerComment #12
berdirLooks like it conflicts with #3253542: FacetBlockAjaxController breaks the RequestStack in Drupal 9.3.0, I didn't review if the fix is even still necessary or if those other changes resolved somehow, just a git apply -3 powered reroll.
Comment #14
mkalkbrenner