Skip to content

Instantly share code, notes, and snippets.

@anarchivist
Created January 28, 2016 17:12
Show Gist options
  • Select an option

  • Save anarchivist/e1563583627602965ea7 to your computer and use it in GitHub Desktop.

Select an option

Save anarchivist/e1563583627602965ea7 to your computer and use it in GitHub Desktop.
diff --git a/app/models/item.rb b/app/models/item.rb
index e405e27..3cc5222 100644
--- a/app/models/item.rb
+++ b/app/models/item.rb
@@ -126,7 +126,14 @@ class Item
end
def preview_image
- @object
+ uri = URI.parse(@object)
+ if uri.kind_of?(URI::HTTP)
+ @object
+ else
+ nil
+ end
+ rescue URI::InvalidURIError
+ nil
end
def data_provider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment