commit dd83366153280f897c8ff2374ee483127ba6bc3a parent 7e0ae34877cff11db0150609c229fa7ba16d2f02 Author: Alex Balgavy <alex@balgavy.eu> Date: Sun, 11 Jun 2023 23:58:23 +0200 linkhandler: try to remove more tracking parameters Diffstat:
M | scripts/linkhandler | | | 8 | +++++--- |
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/linkhandler b/scripts/linkhandler @@ -23,10 +23,12 @@ sub un_urlize { sub untrack { my ($orig_link) = @_; - if ($orig_link =~ /(https?(?::|%3A)%2F%2F.*)/) { - my $new_link = $1; - return un_urlize($new_link); + if ($orig_link =~ /(https?(?::|%3A)(?:%2F%2F|\/\/).*)/) { + $orig_link = un_urlize($1); } + $orig_link =~ s/https?(?::|%3A)(?:%2F%2F|\/\/).*(https?(?::|%3A)(?:%2F%2F|\/\/).*)/$1/; + $orig_link =~ s/utm_[^&]*&?//g; + $orig_link =~ s/\?$//; return $orig_link; }