FIX: prevents malformed href to crash TopicEmbed (#12910)

If the associated page of a remote url passed to `TopicEmber.new(remote_url)` contained a malformed link like: `<a href="(http://foo.bar)">Baz</a>` it would raise an uncaught exception:

```
Job exception: Invalid scheme format: (http
```
This commit is contained in:
Joffrey JAFFEUX
2021-04-30 11:10:19 +02:00
committed by GitHub
parent 2f0205e5c8
commit ed818a4a19
2 changed files with 17 additions and 1 deletions

View File

@ -165,7 +165,7 @@ class TopicEmbed < ActiveRecord::Base
uri.host = original_uri.host
node[url_param] = uri.to_s
end
rescue URI::Error
rescue URI::Error, Addressable::URI::InvalidURIError
# If there is a mistyped URL, just do nothing
end
end