Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After bundle update, carrier wave stopped uploading images from remote url api #2411

Closed
farooqch11 opened this issue Aug 20, 2019 · 9 comments

Comments

@farooqch11
Copy link

NoMethodError: undefined method `[]' for nil:NilClass

@mshibuya
Copy link
Member

Full stack trace please.

@luisarturomtzc
Copy link

same!

@farooqch11
Copy link
Author

i downgraded to last version to make it work in production! but this is was not going.

@mshibuya
Copy link
Member

I need details to track down the issue, what did you do and what happened? How does your code look like and how was the whole stack trace of the error?

@farooqch11
Copy link
Author

i am using carrier wave with the API , once i use remote_image_url, it throws weird error with latest version!

  • update your bundle
    -use api to send remote_url
    -it will break instead of downloading image and uploading again!

@mshibuya
Copy link
Member

I'm telling you that I need full stack trace, please.
That's what you can see like this upon the error, by pressing Full Trace.

@farooqch11
Copy link
Author

@mshibuya i dont have stack trace now, because it was happening on heroku and production! i had to update it quickly without having complaints!

but i mentioned how to regenerate it!

@fukayatsu
Copy link
Contributor

In my case,

undefined method `[]' for nil:NilClass

occurred at

https://github.com/carrierwaveuploader/carrierwave/blob/v2.0.1/lib/carrierwave/downloader/remote_file.rb#L28

when the remote image response header includes content-disposition: inline;filename="" (from google auth image)


[1] pry(main)> match = 'content-disposition: inline;filename=""'.match(/filename=(?:"([^"]+)"|([^";]+))/)
=> nil
[2] pry(main)> match[1].presence || match[2].presence
NoMethodError: undefined method `[]' for nil:NilClass

trace:

vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/downloader/remote_file.rb:28:in `filename_from_header': undefined method `[]' for nil:NilClass (NoMethodError)
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/downloader/remote_file.rb:11:in `original_filename'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/sanitized_file.rb:43:in `original_filename'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/sanitized_file.rb:57:in `filename'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/uploader/cache.rb:133:in `cache!'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/uploader/download.rb:20:in `download!'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mounter.rb:98:in `block (2 levels) in remote_urls='
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mounter.rb:176:in `handle_error'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mounter.rb:96:in `block in remote_urls='
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mounter.rb:95:in `each'
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mounter.rb:95:in `remote_urls='
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/mount.rb:166:in `remote_icon_url='
    from vendor/bundle/ruby/2.6.0/gems/carrierwave-2.0.1/lib/carrierwave/orm/activerecord.rb:21:in `remote_icon_url='
...

@mshibuya
Copy link
Member

Fixed by #2419.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants