Commit dca87ec5 by Jonathan Lim Committed by Jon Yurek

Allow #original_filename= to receive nil argument

parent ad23a0f8
......@@ -20,6 +20,7 @@ module Paperclip
end
def original_filename=(new_filename)
return unless new_filename
@original_filename = new_filename.gsub(OS_RESTRICTED_CHARACTERS, "_")
end
......
......@@ -67,4 +67,11 @@ describe Paperclip::AbstractAdapter do
@adapter.original_filename = "file.png"
expect(@adapter.send(:destination).path).to end_with(".png")
end
context "#original_filename=" do
it "should not fail with a nil original filename" do
adapter = TestAdapter.new
expect{ adapter.original_filename = nil }.not_to raise_error
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment