FIX: properly escape embed url

This commit is contained in:
Maja Komel 2019-01-06 23:12:02 +01:00
parent e0bc82657b
commit 6c8069c65a
1 changed files with 1 additions and 1 deletions

View File

@ -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)