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

Considers words at the end of a sentence as a valid url when looseUrl = true. #19

Closed
MustansirZia opened this issue Jun 8, 2020 · 3 comments

Comments

@MustansirZia
Copy link

Hey!

Really thanks for making this package and it has proven to be quite useful for us. There's one issue however that I found. If looseUrl is set to true then words at the end of sentences are also considered as valid links. It disregards the space after the period. I'm not sure if this is the right package for this issue but I'm still going to add it here.

Here's a live example.
Screenshot 2020-06-08 at 2 37 39 PM

And here's a code snippet.

Linkify(
            text: text,
            maxLines: maxLines,
            overflow: TextOverflow.clip,
            textAlign: TextAlign.start,
            options: LinkifyOptions(
              looseUrl: true,
            ),
            onOpen: (link) async {
              if (await canLaunch(link.url)) {
                await launch(link.url);
              }
            },
)

I'm using package version flutter_linkify: 3.1.2 and flutter version 1.12.13+hotfix.8.

Looking forward to hearing from you!
Thanks again for this package.
Cheers.

@olestole
Copy link

olestole commented Jun 8, 2020

I have the same problem. You could consider changing the _looseurlRegex in UrlLinkifier to (https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)? Check out more examples here

@Cretezy
Copy link
Owner

Cretezy commented Jun 9, 2020

This is a good point, will fix in the next version. Moving to parsing library

@Cretezy Cretezy transferred this issue from Cretezy/flutter_linkify Jun 9, 2020
@Cretezy
Copy link
Owner

Cretezy commented Nov 6, 2020

This has been fixed in v3.0.0

@Cretezy Cretezy closed this as completed Nov 6, 2020
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

3 participants