getResourceFromContext throws error on certain URLs
See original GitHub issueI got the Failed to fetch resource: ...
error on a url where I presume the error has to do with a urlencode
issue. The url in my test was /library/Faculty&Staff
. The getResourceFromContext
function threw the error, with the jsonapi endpoint that it supposedly could not reach, which I was able to load manually in my browser. After removing the &
from the url, so that it read /library/FacultyStaff
the page loaded fine. Let me know if you need any more details.
Edit
I just realized that this url was probably a custom override to the path alias pattern that was setup and sure enough it was. When I checked, generate automatically, it stripped out the &
. My thought though is that why was translatePathFromContext
able to return the jsonapi url in its response but getResourceFromContext
could not load it? Seems like it still should work, or am I missing something?
Issue Analytics
- State:
- Created a year ago
- Comments:6
Thanks.
We’re also running a few 1000+ pages sites with it. Ping here if you have any questions.
PS: Try the DrupalClient. This is where we’ll be focusing future work: https://next-drupal.org/docs/client
Yes. Agreed. It should still work. I just tested and confirmed this is a bug.
I’ll push a fix. A quick
encodeURIComponent
before assembling the route seems to fix it but I’d like to make sure it’s a proper fix.I’ll update here.
Thanks for reporting. Appreciate it.