diff --git a/app/models/photo.rb b/app/models/photo.rb index dd9700ad5..fb6bd526a 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -70,7 +70,7 @@ class Photo < Post end def url(name = nil) - if self.not_processed? || self.image.path.include? '.gif' + if self.not_processed? || (!self.image.path.blank? && self.image.path.include?('.gif')) image.url elsif remote_photo_path name = name.to_s + '_' if name diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 240a9ca8f..482937c27 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -14,7 +14,9 @@ describe Photo do @fail_fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', 'msg.xml') @photo = @user.build_post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id) + @photo.processed = true @photo2 = @user.build_post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id) + @photo2.processed = true end describe "protected attributes" do