Last active
December 13, 2015 17:58
-
-
Save brstp/4951517 to your computer and use it in GitHub Desktop.
Still problem with special characters in filenames when Paperclip let´'s identify validate the file.
Platform dependent. In my case, Win7. With reference to https://github.com/thoughtbot/paperclip/pull/1154 2013-02-14 10:20 CET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################### | |
# A. DEVELOPMENT ENVIRONMENT | |
# Win7/64 | |
------------------------------------------- | |
# Excerpt from Gemfile.lock | |
GIT | |
remote: git://github.com/thoughtbot/paperclip.git | |
revision: e421bc1b0d5806f53be8a664c5f3c70c2e285e7e | |
specs: | |
paperclip (3.4.0) | |
activemodel (>= 3.0.0) | |
activerecord (>= 3.0.0) | |
activesupport (>= 3.0.0) | |
cocaine (~> 0.5.0) | |
mime-types | |
GEM | |
remote: http://rubygems.org/ | |
specs: | |
climate_control (0.0.3) | |
activesupport (>= 3.0) | |
cocaine (0.5.1) | |
climate_control (>= 0.0.3, < 1.0) | |
mime-types (1.21) | |
rails (3.2.12) | |
fog (1.9.0) | |
PLATFORMS | |
x86-mingw32 | |
------------------------------------------- | |
$ ruby -v | |
ruby 1.9.3p194 (2012-04-20) [i386-mingw32] | |
$ which identify | |
/c/Program Files (x86)/ImageMagick-6.8.0-Q16/identify | |
------------------------------------------- | |
# Excerpt from config/environments/development.rb | |
config.paperclip_defaults = { | |
:storage => :fog, | |
:fog_public => true, | |
:fog_directory => 'development.allom.se', | |
:fog_host => 'http://development.allom.se.s3-external-3.amazonaws.com', | |
:fog_credentials => { | |
:aws_access_key_id => ENV['S3_KEY'], | |
:aws_secret_access_key => ENV['S3_SECRET'], | |
:provider => 'AWS', | |
:region => 'eu-west-1' | |
} | |
} | |
------------------------------------------- | |
# Excerpt from app/models/organizer.rb | |
validates_attachment_content_type :logotype, :content_type => /image/ | |
validates_attachment_size :logotype, :in => 0..10.megabytes | |
has_attached_file :logotype, | |
:default_url => "missing-organizer-logotype.png", | |
:path => "organizers/:attachment/:id/:style/:filename", | |
:styles => { | |
:medium => "256x256", | |
:small => "90x90"} | |
------------------------------------------- | |
# Manual test cases | |
1. Upload the file "lumano.gif". | |
Success | |
2. Upload the file "låmano.gif" | |
Fail. Error message: | |
Paperclip::Errors::NotIdentifiedByImageMagickError | |
# Excerpt from log/development | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [1m[36mCACHE (0.0ms)[0m [1mSELECT "organizers".* FROM "organizers" WHERE "organizers"."slug" = 'jazz-pa-malaroarna' LIMIT 1[0m | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [1m[35m (0.0ms)[0m begin transaction | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] Command :: identify -format '%wx%h,%[exif:orientation]' "C:/Users/STEFAN~1/AppData/Local/Temp/låmano20130214-8520-147onsm.gif[0]" | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] Command :: identify -format '%wx%h,%[exif:orientation]' "C:/Users/STEFAN~1/AppData/Local/Temp/låmano20130214-8520-147onsm.gif[0]" | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [1m[36m (0.0ms)[0m [1mrollback transaction[0m | |
[495b9a0570d208456f4e735671b0ff94] [127.0.0.1] [1m[35mUser Load (1.0ms)[0m SELECT "users".* FROM "users" INNER JOIN "memberships" ON "users"."id" = "memberships"."user_id" WHERE "memberships"."organizer_id" = 114 ORDER BY email | |
########################################### | |
# B. DEVELOPMENT ENVIRONMENT | |
# without S3 storage | |
------------------------------------------- | |
# Excerpt from config/environments/development.rb | |
config.paperclip_defaults = { | |
} | |
------------------------------------------- | |
# Manual test cases | |
1. Upload the file "lumano.gif". | |
Success | |
2. Upload the file "låmano.gif" | |
Fail. Error message: | |
Paperclip::Errors::NotIdentifiedByImageMagickError | |
########################################### | |
# C. STAGE ENVIRONMENT | |
# Heroku | |
Stack: cedar | |
------------------------------------------- | |
# Manual test cases | |
1. Upload the file "lumano.gif". | |
Success | |
2. Upload the file "låmano.gif" | |
Success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment