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

autolinks and url-/html-encoded strings #248

Open
klkvsk opened this issue Feb 22, 2024 · 0 comments
Open

autolinks and url-/html-encoded strings #248

klkvsk opened this issue Feb 22, 2024 · 0 comments

Comments

@klkvsk
Copy link

klkvsk commented Feb 22, 2024

Version(s) affected

5.1.1/5.2.x

Description

When using 'use_autolinks' => true it can fail on cases where link's href and text are encoded differently using:

  • HTML encoding (& <> &amp;, etc)
  • URL encoding (%xx sequences)

The strict comparison that autolinks check uses should be softened by converation to a common form.
Also we should probably make that HTML encodings are decoded for markdown output, while URL encodings are left as is, is this right?

How to reproduce

$converter = new HtmlConverter();
$converter->setOptions([ 'use_autolinks' => true ]);
echo $converter->convert('<a href="https://example.com/?a=1&b=foo%2Fbar">https://example.com/?a=1&amp;b=foo/bar</a>');
// [https://example.com/?a=1&amp;b=foo/bar](https://example.com/?a=1&b=foo%2Fbar)
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

No branches or pull requests

1 participant