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."
Comment | File | Size | Author |
---|---|---|---|
#15 | reset_facet_2.PNG | 4.51 KB | dcam |
#13 | 2913636.patch | 1.89 KB | borisson_ |
Comments
Comment #2
dcam CreditAttribution: dcam commentedThis 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.
Comment #4
dcam CreditAttribution: dcam commentedComment #5
borisson_We should wait and use #2861586: Make it easier to programmatically generate facet links?
Comment #6
borisson_#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?
Comment #7
borisson_Comment #8
dcam CreditAttribution: dcam commentedSorry I haven't come back to this sooner. I'll test it again today and see if it's still an issue.
Comment #9
dcam CreditAttribution: dcam commentedHere'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.
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.
Comment #10
borisson_Setting back to active. Looks like we need to improve testcoverage, thanks for coming back to this issue @dcam!
Comment #11
dcam CreditAttribution: dcam commentedI'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.
Comment #12
borisson_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.
Comment #13
borisson_Added a test + fix. I went in a different direction for this fix. Can you test this one @dcam?
Comment #15
dcam CreditAttribution: dcam commentedIt's working for me. I'm glad you were able to figure it out.
Comment #17
StryKaizer