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

Refs #93 -- Revert URL regex and validate URLs separately #94

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

amureki
Copy link
Member

@amureki amureki commented Aug 19, 2024

My initial regex in #93 is not handling correctly URLs without a scheme/www, so I have no better idea here but:

  • parse for everything that seems like a markdown link
  • validate URL and scheme and apply things only to places we want

@amureki amureki added the bug Something isn't working label Aug 19, 2024
@amureki amureki self-assigned this Aug 19, 2024
Copy link
Member

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

I am not so sure if I understand what went wrong. Maybe you could elaborate more?

emark/message.py Outdated Show resolved Hide resolved
emark/message.py Outdated Show resolved Hide resolved
emark/message.py Outdated Show resolved Hide resolved
emark/message.py Outdated Show resolved Hide resolved
@amureki
Copy link
Member Author

amureki commented Aug 19, 2024

I am not so sure if I understand what went wrong. Maybe you could elaborate more?

As I wrote in PR description, UTM injection into certain links was failing with the new regex. And my new tests are covering the failing cases:

[A link without a scheme](www.example.com)
[A link without www](example.com)
[ALL CAPS LINK](HTTP://WWW.EXAMPLE.COM)
[localhost:8000](http://localhost:8000)

Copy link
Member

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

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

There is still some duplication, but it looks good to me 👌

@amureki amureki merged commit 7aa754b into main Aug 23, 2024
10 checks passed
@amureki amureki deleted the url-parsing-is-hard branch August 23, 2024 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants