ActiveStorage: add feature to allow upload from a remote url

Hi !

I’ve seen that it is not possible yet to upload an image with ActiveStorage from a remote url, as it is with other libraries such as Carrierwave. Do you think it could be useful ?

I’ve started working on an implementation. Here is the PR: https://github.com/rails/rails/pull/30834

Feedback is greatly appreciated, especially regarding the questions I had:

  • should I make a dedicated class for remote files ? (will be useful to extend it in the future)
  • where should I define error classes ? I at least need a DownloadError class.

Matthias