fixes #2105
Also fix bug where sources were not escaped at all on post versions page
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module ApplicationHelper
|
||||
def wordbreakify(string)
|
||||
raw(string.gsub(/(.{10})/, "\\1<wbr>"))
|
||||
lines = string.scan(/.{1,10}/)
|
||||
wordbreaked_string = lines.map{|str| h(str)}.join("<wbr>")
|
||||
raw(wordbreaked_string)
|
||||
end
|
||||
|
||||
def nav_link_to(text, url, options = nil)
|
||||
|
||||
@@ -19,11 +19,11 @@ module PostsHelper
|
||||
|
||||
def post_source_tag(post)
|
||||
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
||||
text = "pixiv/<wbr>#{wordbreakify($1)}"
|
||||
text = "pixiv/<wbr>#{wordbreakify($1)}".html_safe
|
||||
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/<wbr>#{wordbreakify($1)}"
|
||||
text = "pixiv/<wbr>#{wordbreakify($1)}".html_safe
|
||||
source_link = link_to(text, post.normalized_source)
|
||||
source_search = "source:#{text}/"
|
||||
elsif post.source =~ %r{\Ahttps?://}
|
||||
|
||||
Reference in New Issue
Block a user