Fix browsing file names that contain percent-encoded @ symbol#2200
Open
jessevanherk wants to merge 1 commit intofreeCodeCamp:mainfrom
Open
Fix browsing file names that contain percent-encoded @ symbol#2200jessevanherk wants to merge 1 commit intofreeCodeCamp:mainfrom
jessevanherk wants to merge 1 commit intofreeCodeCamp:mainfrom
Conversation
This adds an encode method into the javascript code so that users can browser the Godot docs for @globalscope and @GDscript. The bug was mentioned in: freeCodeCamp#1853 This 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 docs. This doesn't use JS' encodeURI or encodeURIComponent because encodeURI doesn't include @, and encodeURIComponent includes / which we don't want. If there are other URL-reserved characters that would be useful to encode, those should be easy enough to add to the short method added here.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
@GlobalScopeand@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.