diff options
author | David Phillips <david@sighup.nz> | 2018-05-07 21:17:47 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-05-07 21:17:47 +1200 |
commit | eb2ff6434ee9ffe9354539186bbb7b8726788e0f (patch) | |
tree | 56885d0b13a8fff0d4b7beb4efca24b6ba5f7b84 /Plugin | |
parent | 817ebdeb8eeaa344fd77a2c84d4e90d4cdf5f66a (diff) | |
download | idalius-eb2ff6434ee9ffe9354539186bbb7b8726788e0f.tar.xz |
Truncate URLs based on shorturl length, not full URL
Diffstat (limited to 'Plugin')
-rw-r--r-- | Plugin/URL_Title.pm | 5 |
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; } |