Escape youtube titles
This commit is contained in:
parent
baac8199da
commit
bd4efe8c2d
4 changed files with 4 additions and 4 deletions
|
|
@ -259,7 +259,7 @@ module ApplicationHelper
|
|||
while youtube = message.match(/youtube\.com::([A-Za-z0-9_\\\-]+)/)
|
||||
video_id = youtube[1]
|
||||
if youtube_maps && youtube_maps[video_id]
|
||||
title = youtube_maps[video_id]
|
||||
title = h(CGI::unescape(youtube_maps[video_id]))
|
||||
else
|
||||
title = I18n.t 'application.helper.video_title.unknown'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module YoutubeTitles
|
|||
return unless youtube_match
|
||||
video_id = youtube_match[1]
|
||||
unless self.youtube_titles[video_id]
|
||||
self.youtube_titles[video_id] = youtube_title_for(video_id)
|
||||
self.youtube_titles[video_id] = CGI::escape(youtube_title_for(video_id))
|
||||
end
|
||||
end
|
||||
YOUTUBE_ID_REGEX = /youtube\.com.*?v=([A-Za-z0-9_\\\-]+)/ unless defined? YOUTUBE_ID_REGEX
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ describe Comment do
|
|||
comment = user.build_comment url, :on => @message
|
||||
|
||||
comment.save!
|
||||
Comment.find(comment.id).youtube_titles.should == {video_id => expected_title}
|
||||
Comment.find(comment.id).youtube_titles.should == {video_id => CGI::escape(expected_title)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ describe StatusMessage do
|
|||
post = @user.build_post :status_message, :message => url, :to => @aspect.id
|
||||
|
||||
post.save!
|
||||
Post.find(post.id).youtube_titles.should == {video_id => expected_title}
|
||||
Post.find(post.id).youtube_titles.should == {video_id => CGI::escape(expected_title)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue