FIX: properly escape embed url

FIX: properly escape embed url

diff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rb
index 9284c41..5258eac 100644
--- a/app/models/topic_embed.rb
+++ b/app/models/topic_embed.rb
@@ -209,7 +209,7 @@ class TopicEmbed < ActiveRecord::Base
 
   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)

GitHub sha: 6c8069c6

1 Like

I think we should add a test for this.