Skip to content
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

Allow more relative links in safe mode (issue #517) #520

Merged
merged 5 commits into from Jul 20, 2023

Conversation

Crozzers
Copy link
Contributor

@Crozzers Crozzers commented Jul 2, 2023

This PR fixes #517 by expanding the scope of the _safe_href regex to include more types of relative links.

Previously, #513 was merged which allowed the following kinds of relative links:

[issue1](./issue1)
[issue1](/issue1)

But did not allow this: [link](issue1)

The new regex should allow URLs to omit the protocol section of the URL or use relative paths instead of a protocol (eg: ./, ../, /) followed by a hostname, optional port number and then the rest of the URL.

I've also expanded the number of accepted protocols to include mailto: and tel:.

Also, the _safe_protocols attribute has been re-introduced to allow users to extend the number of allowed protocols when operating in safe mode (see this comment).

Also added back `_safe_protocols` attr and expanded allowed protocols to include mailto and tel
@Crozzers Crozzers changed the title Allow relative links in safe mode (issue #517) Allow more relative links in safe mode (issue #517) Jul 2, 2023
@nicholasserra
Copy link
Collaborator

@Crozzers wanted to check with you on this before I merge and release. Do you think this PR is done and ready to go?

@rouilj
Copy link

rouilj commented Jul 19, 2023 via email

@Crozzers
Copy link
Contributor Author

Yep, good to go

@nicholasserra nicholasserra merged commit 863a3af into trentm:master Jul 20, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.4.9 generates bad output for 'An [issue1](issue1) link'
3 participants