Commit 7ba125b5 authored by Luc Didry's avatar Luc Didry

Allow only 2 redirections for URL to shorten

parent 1e91640b
Pipeline #1004 passed with stage
...@@ -106,7 +106,7 @@ sub startup { ...@@ -106,7 +106,7 @@ sub startup {
my $url = shift; my $url = shift;
my $nb_redir = shift; my $nb_redir = shift;
if ($nb_redir++ <= 10) { if ($nb_redir++ <= 2) {
my $res = check_fqdn($url->host); my $res = check_fqdn($url->host);
if (defined $res) { if (defined $res) {
return { return {
...@@ -124,12 +124,13 @@ sub startup { ...@@ -124,12 +124,13 @@ sub startup {
} else { } else {
return { return {
is_spam => 1, is_spam => 1,
msg => $c->l('The URL redirects 10 times or most. It\'s most likely a dangerous URL (spam, phishing, etc.). I refuse to shorten it.', $url->host) msg => $c->l('The URL redirects 3 times or most. It\'s most likely a dangerous URL (spam, phishing, etc.). I refuse to shorten it.', $url->host)
} }
} }
} }
); );
# Hooks
$self->hook( $self->hook(
after_dispatch => sub { after_dispatch => sub {
shift->provisioning(); shift->provisioning();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment