Skip to content

autolinks and url-/html-encoded strings #248

@klkvsk

Description

@klkvsk

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions