From: Eugen Rochko Date: Sun, 5 Feb 2017 14:29:16 +0000 (+0100) Subject: Fix showing ellipsis even when link hasn't been cut off X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=6fa4e01139a8420d96f9a3c1fcf2b3c5bd0b38a9;p=mastodon.git Fix showing ellipsis even when link hasn't been cut off --- diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index ff2a16f1b..044407a6c 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -68,8 +68,9 @@ class Formatter prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s text = url[prefix.length, 30] suffix = url[prefix.length + 30..-1] + cutoff = url[prefix.length..-1].length > 30 - "#{prefix}#{text}#{suffix}" + "#{prefix}#{text}#{suffix}" end def hashtag_html(match)