FIX: Strip whitespace from URL before validating (#12174)

This commit is contained in:
Bianca Nenciu 2021-02-25 13:31:38 +02:00 committed by GitHub
parent 13c2a4886f
commit a9a93b15ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class TopicRetriever
private
def invalid_url?
!EmbeddableHost.url_allowed?(@embed_url)
!EmbeddableHost.url_allowed?(@embed_url.strip)
end
def retrieved_recently?

View File

@ -63,6 +63,11 @@ describe TopicRetriever do
end
end
end
it "works with URLs with whitespaces" do
expect { TopicRetriever.new(" https://example.com ").retrieve }
.not_to raise_error
end
end
end