lib/carrierwave/sanitized_file.rb in carrierwave-0.5.8 vs lib/carrierwave/sanitized_file.rb in carrierwave-0.6.0
- old
+ new
@@ -130,11 +130,11 @@
# === Returns
#
# [Boolean] whether the file is valid and has a non-zero size
#
def empty?
- @file.nil? || self.size.nil? || self.size.zero?
+ @file.nil? || self.size.nil? || (self.size.zero? && ! self.exists?)
end
##
# === Returns
#
@@ -236,10 +236,10 @@
#
# [String] the content type of the file
#
def content_type
return @content_type if @content_type
- @file.content_type.chomp if @file.respond_to?(:content_type) and @file.content_type
+ @file.content_type.to_s.chomp if @file.respond_to?(:content_type) and @file.content_type
end
##
# Sets the content type of the file.
#