Skip to content

Commit

Permalink
FIX: properly escape embed url
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Jan 7, 2019
1 parent e0bc826 commit 6c8069c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/topic_embed.rb
Expand Up @@ -209,7 +209,7 @@ def self.absolutize_urls(url, contents)

def self.topic_id_for_embed(embed_url)
embed_url = normalize_url(embed_url).sub(/^https?\:\/\//, '')
TopicEmbed.where("embed_url ~* '^https?://#{Regexp.escape(embed_url)}$'").pluck(:topic_id).first
TopicEmbed.where("embed_url ~* ?", "^https?://#{Regexp.escape(embed_url)}$").pluck(:topic_id).first
end

def self.first_paragraph_from(html)
Expand Down

1 comment on commit 6c8069c

@tgxworld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a test for this.

Please sign in to comment.