I've been developing my own Facets Summary processor today. I did some copying and pasting of the code in the ResetFacetsProcessor to get started. When I finished I noticed that my processor's URLs were incorrect. So I checked the reset link and its URLs had the same problem.

The base URL of the site looks like http://localhost/test-site because it's in the test-site subdirectory.

The reset URL ended up with the subdirectory printed twice like http://localhost/test-site/test-site/search?....

I wish I had a solution ready for you, but I don't. I searched for a while, but didn't come up with a solution. Maybe one of you is more familiar with Symfony Request objects and know exactly what needs to be implemented.

I did end up replacing this:
$url = Url::fromUserInput($request->getRequestUri());

...with this:
$url = Url::fromUri($request->getUriForPath(\Drupal::service('path.current')->getPath()));

...just to finish a proof of concept for my processor, but I'm absolutely certain that's not a "solution."

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dcam created an issue. See original summary.

dcam’s picture

Status: Active » Needs review
FileSize
1.14 KB

This fixed the issue for me. Rather than using the request from the stack which seems to be flawed, I generated a new request from the facet source's path, which always seems to be correct.

I ran the processor's tests and the IntegrationTest. They all passed locally. We'll see if all the others pass now.

Status: Needs review » Needs work

The last submitted patch, 2: 2913636-2-resetfacetsprocessor.patch, failed testing. View results

dcam’s picture

Status: Needs work » Needs review
borisson_’s picture

Status: Needs review » Needs work
borisson_’s picture

Issue tags: +Needs tests

#5 is now no longer relevant. That patch has been committed.

I don't understand why there weren't any failing tests, drupal's testsbots already run all test from a subdirectory (http://localhost/checkout)

@dcam, can you please provide a failing test-case so I understand what exactly is going wrong?

borisson_’s picture

Status: Needs work » Postponed (maintainer needs more info)
dcam’s picture

Sorry I haven't come back to this sooner. I'll test it again today and see if it's still an issue.

dcam’s picture

FileSize
4.55 KB

Here's an image of the Facet Summary HTML. There are two links. The first is the reset link with the doubled subdirectory. The second is the link to turn off an active facet, which doesn't have the doubled subdirectory. This is using the latest dev version from today with a cleared cache.
The Facet Summary HTML output with a doubled subdirectory in the reset link

You can leave this as postponed since I haven't written a test for it, but I wanted to let you know that it's still an issue on my dev site. I'll try to figure out how to write a test for this.

borisson_’s picture

Status: Postponed (maintainer needs more info) » Active

Setting back to active. Looks like we need to improve testcoverage, thanks for coming back to this issue @dcam!

dcam’s picture

I'm going to try one more thing. I'm still running core 8.3 on this dev site. Let me update it and see if maybe that fixes a Symfony dependency or something that corrects the issue.

borisson_’s picture

I just tried it again and I can now reproduce this issue. Trying to come up with a fix. Will update this issue when I give up or find a solution.

borisson_’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
1.89 KB
1.16 KB

Added a test + fix. I went in a different direction for this fix. Can you test this one @dcam?

Status: Needs review » Needs work

The last submitted patch, 13: 2913636-testonly.patch, failed testing. View results

dcam’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
4.51 KB

It's working for me. I'm glad you were able to figure it out.
The Facet Summary HTML output without a doubled subdirectory in the reset link

  • StryKaizer committed 4fabe1d on 8.x-1.x authored by borisson_
    Issue #2913636 by borisson_, dcam: ResetFacetsProcessor generates...
StryKaizer’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.