diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index f934179d47..c2b04b98b5 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -28,3 +28,12 @@ if Paperclip::VERSION.to_f < 3.5 else Rails.logger.warn "The Paperclip::GeometryDetector patch can now be removed." end + +module UpdatedUrlGenerator + def escape_url(url) + (url.respond_to?(:escape) ? url.escape : URI::Parser.new.escape(url)). + gsub(/(\/.+)\?(.+\.)/, '\1%3F\2') + end +end + +Paperclip::UrlGenerator.prepend(UpdatedUrlGenerator)