mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: If there is an invalid URI in the import, don't throw an error
This commit is contained in:
parent
4da76aab96
commit
ce40a27274
1 changed files with 9 additions and 5 deletions
|
@ -76,11 +76,15 @@ class TopicEmbed < ActiveRecord::Base
|
||||||
url_param = tags[node.name]
|
url_param = tags[node.name]
|
||||||
src = node[url_param]
|
src = node[url_param]
|
||||||
unless (src.empty?)
|
unless (src.empty?)
|
||||||
uri = URI.parse(src)
|
begin
|
||||||
unless uri.host
|
uri = URI.parse(src)
|
||||||
uri.scheme = original_uri.scheme
|
unless uri.host
|
||||||
uri.host = original_uri.host
|
uri.scheme = original_uri.scheme
|
||||||
node[url_param] = uri.to_s
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue