LoginSignup
2
0

More than 3 years have passed since last update.

carrierwave 2.0.0の不具合について

Posted at

起こる症状

  • carrierwaveが2.0.0の状態で、remoteのURLから画像をアップロードしようとするとエラーが発生する模様。
# omniauthの画像URLとか
user.remote_profile_image_url = auth.info.image

# NoMethodError (undefined method `[]' for nil:NilClass)
  • 該当するエラー箇所はここらしい
# lib/carrierwave/downloader/remote_file.rb

def filename_from_header
  if file.meta.include? 'content-disposition'
    match = file.meta['content-disposition'].match(/filename=(?:"([^"]+)"|([^";]+))/)
    match[1].presence || match[2].presence # ここ
  end
end

解決策

  • バージョンを1.3.1に戻す
gem 'carrierwave', '~> 1.3.1'
2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0