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

Fix bogus mailto links generated by the Markdown parser. #2165

Merged
merged 1 commit into from
May 18, 2018

Conversation

s-ludwig
Copy link
Member

Whenever an "at" character was in an auto URL, the contents were treated as an e-mail address. This was even the case for URLs such as "http://foo/bar@baz".

url = pstr[0 .. cidx];
if( anyOf(url, " \t") ) return false;
if( !anyOf(url, ":@") ) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

":@" is now valid.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anything changes related to this condition, because it is replicated below as atidx < 0 && colonidx < 0. ":@" will not be accepted due to the length check at the top, but indeed this will let a lot of invalid cases go through. True validation has to be done as a separate step

test(false, "<http://foo/", null);
test(true, "<mailto:foo@bar>", "mailto:foo@bar");
test(true, "<foo@bar>", "mailto:foo@bar");
test(true, "<proto:foo@bar>", "proto:foo@bar");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a test that checks for : after @?
e.g. when a custom port is used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, plus allowed "foo:foo"@bar style e-mail addresses.

Whenever an "at" character was in an auto URL, the contents were treated as an e-mail address. This was even the case for URLs such as "http://foo/bar@baz".
@s-ludwig s-ludwig merged commit 7dda140 into master May 18, 2018
@s-ludwig s-ludwig deleted the fix_markdown_email_links branch May 18, 2018 08:27
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 participants