fix(dev): properly support slugs with URL-encoded characters #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A German partner was running into an issue with local PagesJS development. The slug field values for a number of their locations contained special, German characters. When navigating to an entity page with such a slug, the resultant
generate-test-data
command would fail. An example slug would be something like:thüringen/gotha/harjesstraße-5
In
serverRenderSlugRoute
, we were re-constructing the slug value using an encoded version of the URL. That is, instead of the value being the above, PagesJS computed it to be:th%C3%BCringen/gotha/harjesstra%C3%9Fe-5
This URL-encoded slug was then passed directly to
generate-test-data
, which could obviously find no corresponding entity. In this PR, I fixed the re-construction of the slug to ensure that it never includes any URL-encoding. I also had to update the call tosendAppHTML
because the name/path of the Virtual Module doesn't include URL-encoding either.Note that this issue was only present when running the PagesJS dev server. Builds worked just fine.
J=SLAP-2676
TEST=manual
Verified that I could navigate to a page with a German character in the slug. Verified that I could navigate to a page with no special characters in the slug. Verified that the produciton build still worked as expected.