From ce40a27274e7d148f5f373b9f5070f580af3999a Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 9 Apr 2014 11:04:45 -0400 Subject: [PATCH] FIX: If there is an invalid URI in the import, don't throw an error --- app/models/topic_embed.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rb index 4f122ae40..c7c4cf290 100644 --- a/app/models/topic_embed.rb +++ b/app/models/topic_embed.rb @@ -76,11 +76,15 @@ class TopicEmbed < ActiveRecord::Base url_param = tags[node.name] src = node[url_param] unless (src.empty?) - uri = URI.parse(src) - unless uri.host - uri.scheme = original_uri.scheme - uri.host = original_uri.host - node[url_param] = uri.to_s + 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