FIX: If there is an invalid URI in the import, don't throw an error
This commit is contained in:
parent
4da76aab96
commit
ce40a27274
|
@ -76,12 +76,16 @@ class TopicEmbed < ActiveRecord::Base
|
|||
url_param = tags[node.name]
|
||||
src = node[url_param]
|
||||
unless (src.empty?)
|
||||
begin
|
||||
uri = URI.parse(src)
|
||||
unless uri.host
|
||||
uri.scheme = original_uri.scheme
|
||||
uri.host = original_uri.host
|
||||
node[url_param] = uri.to_s
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
# If there is a mistyped URL, just do nothing
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue