ClearURLs works almost flawlessly, but the way it processes some links from Gmail messages breaks links.
I notice this primarily when clicking links in email alerts sent by Google Job Search.
When I hover over links the URL begins with https://notifications.googleapis.com/email/redirect? (call it url A in its entirety). Copying and pasting the link into a new tab works fine.
However, clicking the link doesn't work and leads to "Error 400 (Bad Request)".
Using the log I can see that the link is processed by the "This url is redirected" rule.
Before processing, the URL starts with https://www.google.com/url?q=https://notifications.googleapis.com/email/redirect? (call this URL B).
After processing it again starts with https://notifications.googleapis.com/email/redirect? (call this URL C).
Additionally, URL B contains several query parameters that are not in URL A, namely source, ust, and usg. These also happen to be stripped in URL C. I believe these are part of Google redirection and don't seem important for function.
More notably, I'm observing some issues with the URL encoding that appear to be the problem. ClearURLs seems to be doing some sequence of encoding and decoding that breaks the URL, which seems especially fragile since it is still contains a form of redirect. The % character in many encoded characters becomes itself percent encoded in URL B. After processing, in URL C, they are completely decoded and become invalid query parameters. See https://stackoverflow.com/a/4858211 for an explanation.
For example, what is properly escaped as %3D in a working url becomes doubly encoded to %253D, which is then fully decoded into =. Similarly for &.
My best guess is that during processing the URL is decoded twice, when it should only be decoded once so that it is properly escaped. Either that or ClearURLs performs a possibly unnecessary encoding step before processing.
ClearURLs works almost flawlessly, but the way it processes some links from Gmail messages breaks links.
I notice this primarily when clicking links in email alerts sent by Google Job Search.
When I hover over links the URL begins with
https://notifications.googleapis.com/email/redirect?(call it url A in its entirety). Copying and pasting the link into a new tab works fine.However, clicking the link doesn't work and leads to "Error 400 (Bad Request)".
Using the log I can see that the link is processed by the "This url is redirected" rule.
Before processing, the URL starts with
https://www.google.com/url?q=https://notifications.googleapis.com/email/redirect?(call this URL B).After processing it again starts with
https://notifications.googleapis.com/email/redirect?(call this URL C).Additionally, URL B contains several query parameters that are not in URL A, namely
source,ust, andusg. These also happen to be stripped in URL C. I believe these are part of Google redirection and don't seem important for function.More notably, I'm observing some issues with the URL encoding that appear to be the problem. ClearURLs seems to be doing some sequence of encoding and decoding that breaks the URL, which seems especially fragile since it is still contains a form of redirect. The
%character in many encoded characters becomes itself percent encoded in URL B. After processing, in URL C, they are completely decoded and become invalid query parameters. See https://stackoverflow.com/a/4858211 for an explanation.For example, what is properly escaped as
%3Din a working url becomes doubly encoded to%253D, which is then fully decoded into=. Similarly for&.My best guess is that during processing the URL is decoded twice, when it should only be decoded once so that it is properly escaped. Either that or ClearURLs performs a possibly unnecessary encoding step before processing.