Fix browsing file names that contain percent-encoded @ symbol #2200
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.
This fixes browsing the Godot docs for
@GlobalScope
and@GDScript
, by adding a short encode method to handle the@
symbol.The bug was mentioned in #1853 , where the author was unable to determine why they couldn't browse these files.
This PR adds the encoding on the frontend, rather than trying to override filename generation in scrapers. It's possible that this will impact other documentation sources, but I expect those would also need to have encoded the @ as %40 in their own doc filenames. This PR only impacts filename matching, not entries (which already use slugs).
If reviewers knows of other languages that use
@
in a similar way, I'd be happy to test against them!This doesn't use Javascript's encodeURI or encodeURIComponent methods, because encodeURI doesn't replace
@
, and encodeURIComponent replaces/
which we don't want. If there are other URL-reserved charactersthat would be useful to encode, those should be easy enough to add to the short method I added here.
QA
Testing done in local instance of devdocs.