From 8875993ae11cdf058cdd752fb6f0eb07c8368a7f Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Sun, 7 Jan 2018 02:31:35 +0530 Subject: [PATCH] FIX: URI must be ascii only for URI.parse command --- app/models/topic.rb | 2 +- spec/models/topic_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/topic.rb b/app/models/topic.rb index b6138ac975b..3561ffbc5b0 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1273,7 +1273,7 @@ SQL end def featured_link_root_domain - MiniSuffix.domain(URI.parse(self.featured_link).hostname) + MiniSuffix.domain(URI.parse(URI.encode(self.featured_link)).hostname) end private diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index 7134b101343..14a42e3406f 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -2101,6 +2101,7 @@ describe Topic do "https://meta.discourse.org", "https://meta.discourse.org/", "https://meta.discourse.org/?filter=test", + "https://meta.discourse.org/t/中國/1", ].each do |featured_link| it "should extract the root domain from #{featured_link} correctly" do topic.featured_link = featured_link