Paperclip 2.3.5中的错误重新处理

时间:2010-10-29 19:21:52

标签: ruby-on-rails ruby-on-rails-3 amazon-s3 paperclip

我从2.3.3到2.3.5更新了字符串到数组的bug,现在当我尝试调用Model.image.reprocess时!我收到以下错误。这是我的代码中的东西还是回形针中的东西?或者也许在我上传的图片中?

"\xFF" from ASCII-8BIT to UTF-8
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/paperclip-2.3.5/lib/paperclip/storage/s3.rb:134:in `to_file'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/paperclip-2.3.5/lib/paperclip/attachment.rb:219:in `reprocess!'
/home/brian/Dropbox/portfolio/app/models/asset.rb:34:in `regenerate_styles!'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/performable_method.rb:20:in `perform'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/backend/base.rb:77:in `invoke_job'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:118:in `block (2 levels) in run'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:118:in `block in run'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:117:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:176:in `reserve_and_run_one_job'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:102:in `block in work_off'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:101:in `times'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:101:in `work_off'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:76:in `block (2 levels) in start'
/home/brian/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:75:in `block in start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:72:in `loop'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/worker.rb:72:in `start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:100:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:79:in `block in run_process'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `block in start_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call_as_daemon'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:254:in `start_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/application.rb:294:in `start'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/controller.rb:70:in `run'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons.rb:193:in `block in run_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `call'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `catch_exceptions'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/gems/daemons-1.1.0/lib/daemons.rb:192:in `run_proc'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:78:in `run_process'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:72:in `block in daemonize'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:70:in `times'
/home/brian/.rvm/gems/ruby-1.9.2-p0@sp/bundler/gems/delayed_job-aba9905764c2/lib/delayed/command.rb:70:in `daemonize'
script/delayed_job:5:in `<main>'

相关模型:

class Asset < ActiveRecord::Base
  attr_accessible :image, :image_file_name, :image_content_type, :image_file_size, :portfolio_item_id, :order

  belongs_to :portfolio_item

  has_attached_file :image,
    :styles => {
      :thumb => "20x20#",
      :small => "100x100",
      :large => "600x600>"
               },
    :storage => :s3,
    :s3_credentials => {
      :access_key_id => ENV["S3_KEY"],
      :secret_access_key => ENV["S3_SECRET"]
                       },
    :bucket => ENV["S3_BUCKET"],
    :path => "portfolio/:attachment/:id/:style/:basename.:extension"

  before_image_post_process do |image|
    if changed?
      processing = true
      false
    end
  end

  after_save do |image|
    if image.changed?
      send_later(:regenerate_styles!)
    end
  end

  def regenerate_styles!
    self.image.reprocess!
    self.processing = false
    self.save(false)
  end

  def changed?
    self.image_file_size_changed? ||
    self.image_file_name_changed? ||
    self.image_content_type_changed? ||
    self.image_update_at_changed?
  end
end

2 个答案:

答案 0 :(得分:0)

这是paperclip的错误。恢复到以前的版本,你会没事的。这真的让我把头发拉了几天。 :)

答案 1 :(得分:0)

不是答案,只是确认我有同样的问题。 我在Rails 3上并尝试使用Paperclip 2.3.5,2.3.4和2.3.3 在调用reprocess

时,所有这些都无法获得与@Reactor5相同的错误

有什么想法吗?

修改 我更多地研究了这个。这似乎是Paperclip和Ruby 1.9.2的一个问题 仍然不知道究竟是什么导致它,但切换到Ruby 1.8.7为我解决了这个问题。