Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow empty files to be uploaded

  • Loading branch information...
commit a09a36e708e8ece1e35f777fed9de6ecb2185129 1 parent 7e5913b
@Arjeno authored
View
2  lib/carrierwave/sanitized_file.rb
@@ -132,7 +132,7 @@ def is_path?
# [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.file.is_a?(File))
end
##
View
8 spec/sanitized_file_spec.rb
@@ -32,14 +32,6 @@
@sanitized_file.should be_empty
end
- it "should be empty for a file with a zero size" do
- FileUtils.rm file_path('llama.jpg')
- FileUtils.touch file_path('llama.jpg')
-
- @sanitized_file = CarrierWave::SanitizedFile.new(File.open(file_path('llama.jpg')))
- @sanitized_file.should be_empty
- end
-
end
describe '#original_filename' do
Please sign in to comment.
Something went wrong with that request. Please try again.