UTF-8 characters trigger S3 error #923

Closed
phene opened this Issue Jun 19, 2012 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

phene commented Jun 19, 2012

This issue has been mentioned many times before, and after attempting to use the patch provided by paperclip, I still ran into the failure.

[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:280:in `inspect'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:280:in `summarize_value'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:105:in `block in summarize_hash'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:105:in `each'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:105:in `map'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:105:in `summarize_hash'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:195:in `_options'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `block in format'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `gsub'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/log_formatter.rb:169:in `format'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:303:in `log_response'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:294:in `log_client_request'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:363:in `block in client_request'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:275:in `return_or_raise'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/core/client.rb:362:in `client_request'
(eval):3:in `put_object'
[GEM_ROOT]/gems/aws-sdk-1.4.1/lib/aws/s3/s3_object.rb:315:in `write'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:309:in `block in flush_writes'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:295:in `each'
[GEM_ROOT]/gems/paperclip-3.1.2/lib/paperclip/storage/s3.rb:295:in `flush_writes'

This patch is the only thing I've found to fix this.

class Paperclip
  # Fixes issue with S3 + UTF-8 filenames
  class AbstractAdapter
    def inspect
      "#{self.class}: #{self.original_filename}"
    end
  end
end
Contributor

sikachu commented Jun 19, 2012

Urghhhhhh .... This aws-sdk glitch is killing me.

Would you mind implement that inspect method with test in AbstractAdapter and submit a pull request? I am pretty sure it would be better to put it there to clean things up. I want this to be resolved once and for all.

zucay commented Jun 27, 2012

I have submitted another way to solve this issue.
zucay/paperclip@8c39773

This patch is localized in storage/s3.rb

Contributor

phene commented Jun 27, 2012

Why rescue the exception when you can bypass its triggering altogether?

zucay commented Jun 28, 2012

Revised patch is here.
zucay/paperclip@40b714b

Contributor

sikachu commented Jul 4, 2012

@zucay is the patch from @phene solves your issue? I'd rather just fix that instead of having a conditional in monkey patch.

@phene if adding #inspect really solves the problem, I'll be leaning to add that instead.

sikachu was assigned Jul 4, 2012

sikachu closed this in a1690c5 Jul 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment