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

Tracking URL not working for Accented Characters #2258

Open
harrymsn0 opened this issue Nov 28, 2022 · 1 comment
Open

Tracking URL not working for Accented Characters #2258

harrymsn0 opened this issue Nov 28, 2022 · 1 comment
Labels

Comments

@harrymsn0
Copy link

Folks,

URL Tracking breaks when there are Accented Characters.

Example of URL that does not work:
https://domain.com/auth/signin?utm_source=canal_proprietario&utm_medium=email&utm_campaign=1_botão2

I tried to fix it by editing app/lib/postal/message_parser.rb:

On line 4:

URL_REGEX = /(?<url>(?<protocol>https?)\:\/\/(?<domain>[A-Za-z0-9\-\.\:]+)(?<path>\/[A-Za-z0-9\.\/\+\?\&\-\_\%\=\,\~\:\;\(\)\[\]#]*)?+)/

I changed to:

URL_REGEX = /(?<url>(?<protocol>https?)\:\/\/(?<domain>[A-Za-z0-9\-\.\:]+)(?<path>\/[a-zA-Zà-úÀ-Ú0-9\.\/\+\?\&\-\_\%\=\,\~\:\;\(\)\[\]#]*)?+)/

This change works fine on regex101.com, but does not work on Postal. Actually it breaks all tracking urls.

@harrymsn0 harrymsn0 added the bug label Nov 28, 2022
@willpower232
Copy link
Collaborator

It looks like the implementation of regex in ruby might be a little different/opinionated

The documentation mentions some POSIX-style matching syntax which might be more accurate, are you able to check?

https://ruby-doc.org/core-2.7.0/Regexp.html#class-Regexp-label-Character+Properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants