From 601a016a98036d80bda2b66bc94299c70cb2a198 Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 2 Dec 2014 15:59:43 -0500 Subject: [PATCH] Don't try to display ugoira thumbnail/webm before they exist --- app/models/post.rb | 2 +- app/views/posts/partials/show/_ugoira.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 93ee975e2..62ad46ef9 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -154,7 +154,7 @@ class Post < ActiveRecord::Base end def has_ugoira_webm? - created_at < 1.minute.ago || File.exists?(preview_file_path) + created_at < 1.minute.ago || (File.exists?(preview_file_path) && File.size(preview_file_path) > 0) end end diff --git a/app/views/posts/partials/show/_ugoira.html.erb b/app/views/posts/partials/show/_ugoira.html.erb index 1c7f29ec0..3b18dfa49 100644 --- a/app/views/posts/partials/show/_ugoira.html.erb +++ b/app/views/posts/partials/show/_ugoira.html.erb @@ -1,4 +1,4 @@ -<% if CurrentUser.user.default_image_size == "large" && params[:original].blank? %> +<% if CurrentUser.user.default_image_size == "large" && params[:original].blank? && post.has_ugoira_webm? %> <%= render "posts/partials/show/ugoira_webm", :post => post %> <% else %> <%= render "posts/partials/show/ugoira_original", :post => post %>