Cannot download images with Carrierwave's remote_image_url if served via IPv6

72 Views Asked by At

I've got a Rails model with an associated image that's managed via CarrierWave.

class BlogPost
  # ...
  mount_uploader :image, BlogPostImageUploader
  # ...
end

class BlogPostImageUploader < ApplicationUploader
  # ...
end

I've also got a FactoryBot configuration that will automatically set the remote_image_url attribute when initializing a blog post.

FactoryBot.define :blog_post do
  # ...
  remote_image_url { "https://unsplash.it/1024/576/?random" }
  # ...
end

CarrierWave seems to fail to be able to download the image:

irb > FactoryBot.create(:blog_post)
ActiveRecord::RecordInvalid: Validation failed: Image could not download file: Failed to open TCP connection to 2606:4700:20::681a:41e:443 (No route to host - connect(2) for "2606:4700:20::681a:41e" port 443)

It looks like maybe CarrierWave does not support downloading images from IPv6 addresses. Any workarounds for this?

0

There are 0 best solutions below