mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Fix deprecation warning in Paperclip
Fixes deprecation warnings in Paperclip::UrlGenerator#escape_url On a side note: we shouldn't be using Paperclip at all, and should migrate to ActiveStorage.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user