mirror of
https://github.com/discourse/discourse.git
synced 2025-06-12 23:33:46 +08:00
FIX: Strip whitespace from URL before validating (#12174)
This commit is contained in:
@ -15,7 +15,7 @@ class TopicRetriever
|
|||||||
private
|
private
|
||||||
|
|
||||||
def invalid_url?
|
def invalid_url?
|
||||||
!EmbeddableHost.url_allowed?(@embed_url)
|
!EmbeddableHost.url_allowed?(@embed_url.strip)
|
||||||
end
|
end
|
||||||
|
|
||||||
def retrieved_recently?
|
def retrieved_recently?
|
||||||
|
@ -63,6 +63,11 @@ describe TopicRetriever do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "works with URLs with whitespaces" do
|
||||||
|
expect { TopicRetriever.new(" https://example.com ").retrieve }
|
||||||
|
.not_to raise_error
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user