From b523ed471cb80646916d6a7b23490a0dd02d541e Mon Sep 17 00:00:00 2001 From: r888888888 Date: Fri, 28 Feb 2014 17:57:33 -0800 Subject: [PATCH] fixes #1249 --- app/helpers/posts_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 2abf9b765..5b65c939d 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -17,13 +17,17 @@ module PostsHelper end end + def wordbreakify(string) + string.gsub(/(.{15})/, "\\1") + end + def post_source_tag(post) if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/! - text = "pixiv/#{$1}" + text = "pixiv/#{wordbreakify($1)}" source_link = link_to(text, post.normalized_source) source_search = "source:#{text}/" elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/! - text = "pixiv/#{$1}" + text = "pixiv/#{wordbreakify($1)}" source_link = link_to(text, post.normalized_source) source_search = "source:#{text}/" elsif post.source =~ %r{\Ahttps?://}