-
Couldn't load subscription status.
- Fork 180
Fix #878 : prevent trailing slashes on absolute Wikipedia URLs #934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@reshma045 There are way too many unintended changes here. There should only be changes to @reshma045 If you need help or more direct guidance please let me know. It's better that you ask us than to continue iterating if you are not sure what the specific changes required are. |
| const isAbsoluteUrl = (url: string | undefined): boolean => { | ||
| if (!url) return false; | ||
| // matches scheme:// or scheme: (mailto:, tel:, etc.) or protocol-relative //example.com | ||
| return /^(?:[a-zA-Z][a-zA-Z\d+\-.]*:)?\/\//.test(url) || /^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is more complex than it really needs to be. There's no need to cover every possible protocol, possibly just https:// is enough. Also the check for undefined parameter isn't necessary since we don't expect to call this function with no arguments, it probably don't even need to be a function nor use regex I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will update it correctly.
|
@reshma045 it looks like you're not reviewing your own changes (packages downgraded on previous PR, slashes here). That would be a good habit to practice before you make a commit and before making a PR. |
My apologies, but those 1000+ file changes were a result of |
Summary:
This PR fixes the issue where absolute Wikipedia URLs in the generated reference docs had unwanted trailing slashes.
Closes #878
What was done:
src/scripts/builders/reference.tsto add a check preventing trailing slashes on absolute URLs (URLs starting with http)npm run build:referenceto regenerate the reference documentation filespackage-lock.jsonThanks to the maintainers for the guidance!