aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-05-07 21:17:47 +1200
committerDavid Phillips <david@sighup.nz>2018-05-07 21:17:47 +1200
commiteb2ff6434ee9ffe9354539186bbb7b8726788e0f (patch)
tree56885d0b13a8fff0d4b7beb4efca24b6ba5f7b84 /Plugin
parent817ebdeb8eeaa344fd77a2c84d4e90d4cdf5f66a (diff)
downloadidalius-eb2ff6434ee9ffe9354539186bbb7b8726788e0f.tar.xz
Truncate URLs based on shorturl length, not full URL
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/URL_Title.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/Plugin/URL_Title.pm b/Plugin/URL_Title.pm
index 1d0056e..3297bed 100644
--- a/Plugin/URL_Title.pm
+++ b/Plugin/URL_Title.pm
@@ -71,12 +71,13 @@ sub message
return unless $title;
my $shorturl = $url;
- $shorturl = (substr $url, 0, $config{url_len}) . "…" if length ($url) > $config{url_len};
-
# remove http(s):// to avoid triggering other poorly configured bots
$shorturl =~ s,^https?://,,g;
$shorturl =~ s,/$,,g;
+ # truncate URL without http(s):// to configured length if needed
+ $shorturl = (substr $shorturl, 0, $config{url_len}) . "…" if length ($shorturl) > $config{url_len};
+
my $composed_title = "$title ($shorturl)";
return $composed_title;
}