FIX: Embedded topic was not found when URL contained query string

This commit is contained in:
Gerhard Schlager
2018-02-14 00:28:16 +01:00
parent 22f0b0096d
commit 5a56746610
2 changed files with 6 additions and 1 deletions

View File

@@ -183,7 +183,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?://#{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)