Commit 94eb2916 by Jon Yurek

Formatting and anchoring the extension gsub to the end

parent 7d29d06d
......@@ -74,11 +74,11 @@ module Paperclip
return nil if uploaded_file.nil?
logger.info("[paperclip] Writing attributes for #{name}")
@queued_for_write[:original] = uploaded_file.to_tempfile
instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^\w\d\.\-]+/, '_'))
instance_write(:content_type, uploaded_file.content_type.strip)
instance_write(:file_size, uploaded_file.size.to_i)
instance_write(:updated_at, Time.now)
@queued_for_write[:original] = uploaded_file.to_tempfile
instance_write(:file_name, uploaded_file.original_filename.strip.gsub(/[^\w\d\.\-]+/, '_'))
instance_write(:content_type, uploaded_file.content_type.strip)
instance_write(:file_size, uploaded_file.size.to_i)
instance_write(:updated_at, Time.now)
@dirty = true
......@@ -169,7 +169,7 @@ module Paperclip
attachment.instance.class.name.underscore.pluralize
end,
:basename => lambda do |attachment,style|
attachment.original_filename.gsub(File.extname(attachment.original_filename), "")
attachment.original_filename.gsub(/#{File.extname(attachment.original_filename)}$/, "")
end,
:extension => lambda do |attachment,style|
((style = attachment.styles[style]) && style.last) ||
......
......@@ -174,7 +174,6 @@ class AttachmentTest < Test::Unit::TestCase
should "strip whitespace from content_type field" do
assert_equal "image/png", @dummy.avatar.instance.avatar_content_type
end
end
context "Attachment with strange letters" do
......
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