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

CV2-5148: Use more inclusive detection of URLs in message text #2013

Merged

Conversation

computermacgyver
Copy link
Contributor

@computermacgyver computermacgyver commented Aug 28, 2024

Description

URI.regexp.match... only matched fully-qualified urls (i.e., urls need to include http://, https://, or another protocol) . I knew this at the time I did #2011 , but I didn't realize until testing that this was inconsistent with how WhatsApp handles URLs.

The changes in this PR use Twitter::TwitterText::Extractor.extract_urls, which recognizes urls without the protocol. This is consistent with how WhatsApp and more in line with user expectations.

References: CV2-5148

How has this been tested?

Added a unit test for this specific case

Things to pay attention to during code review

N/A

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

URI.regexp.match... only matched fully-qualified urls
(i.e., urls need to include http://, https://, or another protocol)
Twitter::TwitterText::Extractor.extract_urls recognizes urls without
the protocol. This is consistent with how WhatsApp and other platforms
parse URLs and more in line with user expectations.
@caiosba caiosba removed their request for review August 28, 2024 13:46
Copy link
Contributor

@DGaffney DGaffney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@computermacgyver computermacgyver merged commit 9a30cf1 into develop Aug 29, 2024
10 checks passed
@computermacgyver computermacgyver deleted the CV2-5148-tweak-what-is-a-url-for-tipline-shortcut branch August 29, 2024 14:46
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

Successfully merging this pull request may close these issues.

4 participants