Skip to content

Linkify an url ending with a dash fails #29

Description

@lode

I have a url, https://medianewsletter.net/lets-give-reader-comments-another-chance-and-for-real-this-time-77506d29856b?source=user_profile---------9---------------- which results in an empty output. If I change it to not end with a dash all works fine.

I can remove the dash from

[^\s`!\-()\[\]{};:\'".,<>?«»“”‘’] # not a space or one of these punct chars
and it is fixed. However a test will fails which explicitly tests this:
"test": "http://www.example.com/example-example/-",
"expected": "<a href=\"http://www.example.com/example-example/\">http://www.example.com/example-example/</a>-"
which is assumed to let the dash be excluded from the url.

I don't really understand the requirements here. I could understand if there is a dash in front of the url as well (-http://www.example.com/example-example/-) as it is similar to brackets. But only one at the end should be considered part of the url I would say. E.g. taking into account poorly-written slugify services which don't strip dashes at the end of a slug.

Is it something that can go? Anyone passing by who happens to rely on this behavior?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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