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

@s-ludwig s-ludwig commented May 16, 2018

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;

This comment has been minimized.

@wilzbach

wilzbach May 17, 2018
Member

":@" is now valid.

This comment has been minimized.

@s-ludwig

s-ludwig May 17, 2018
Author Member

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");

This comment has been minimized.

@wilzbach

wilzbach May 17, 2018
Member

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

This comment has been minimized.

@s-ludwig

s-ludwig May 17, 2018
Author Member

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 force-pushed the fix_markdown_email_links branch from 2681ceb to a844b9f May 17, 2018
@s-ludwig s-ludwig merged commit 7dda140 into master May 18, 2018
3 checks passed
3 checks passed
codecov/patch 100% of diff hit (target 58.621%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@s-ludwig s-ludwig deleted the fix_markdown_email_links branch May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants