I am running into an issue with CarrierWave::Downloader::Base#process_uri where a valid URL becomes invalid after CarrierWave processes it.
The URL I provide is not encoded. It contains a literal + in the path. That + is valid for this server and must remain a literal +. However, CarrierWave’s URI processing converts it to %2B, and the resulting URL returns 404 Not Found.
Example:
Input URL (works):
https://pokemoncardimages.pokedata.io/images/Red+Flash/016.webp
URL after CarrierWave processing (fails):
https://pokemoncardimages.pokedata.io/images/Red%2BFlash/016.webp
Because of this, assigning something like:
model.remote_image_url = 'https://pokemoncardimages.pokedata.io/images/Red+Flash/016.webp'
ends up raising:
could not download file: 404 "Not Found"
To work around the problem I currently have a monkey patch for process_uri that normalizes using Addressable::URI while preserving the + in the path, but I would prefer not to patch CarrierWave internals.
Would you consider adjusting process_uri so that it does not percent-encode + characters in the path (or otherwise preserves the original path when it is already a valid URI for HTTP requests)?
I can provide a minimal reproduction if needed.
Thanks.
I am running into an issue with
CarrierWave::Downloader::Base#process_uriwhere a valid URL becomes invalid after CarrierWave processes it.The URL I provide is not encoded. It contains a literal
+in the path. That+is valid for this server and must remain a literal+. However, CarrierWave’s URI processing converts it to%2B, and the resulting URL returns404 Not Found.Example:
Because of this, assigning something like:
ends up raising:
To work around the problem I currently have a monkey patch for
process_urithat normalizes usingAddressable::URIwhile preserving the+in the path, but I would prefer not to patch CarrierWave internals.Would you consider adjusting
process_uriso that it does not percent-encode+characters in the path (or otherwise preserves the original path when it is already a valid URI for HTTP requests)?I can provide a minimal reproduction if needed.
Thanks.