This commit is contained in:
Toks
2013-04-11 17:45:37 -04:00
parent 70c816aace
commit ee5310782b

View File

@@ -21,11 +21,11 @@ module PostsHelper
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
text = "pixiv/#{$1}"
source_link = link_to(text, post.normalized_source)
source_search = "source:#{text}"
source_search = "source:#{text}/"
elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/!
text = "pixiv/#{$1}"
source_link = link_to(text, post.normalized_source)
source_search = "source:#{text}"
source_search = "source:#{text}/"
elsif post.source =~ /^http/
text = truncate(post.normalized_source.sub(/^https?:\/\/(?:www\.)?/, ""))
source_link = link_to(truncate(text, :length => 20), post.normalized_source)