Files
nairobi/config/initializers/paperclip.rb
Javi Martín 4f4f8f6180 Supress warnings in Paperclip::UrlGenerator
We were getting hundreds of "warning: URI.escape is obsolete" messages.
So we're using `URI::DEFAULT_PARSER.escape` instead.

IMHO it's OK to add this monkey-patch because we're replacing Paperclip
with Active Storage, and when we finish with that we'll delete this
file.
2021-09-03 12:12:38 +02:00

14 lines
356 B
Ruby

class Paperclip::UrlGenerator
private
# Code copied from the paperclip gem, only replacing
# `URI.escape` with `URI::DEFAULT_PARSER.escape`
def escape_url(url)
if url.respond_to?(:escape)
url.escape
else
URI::DEFAULT_PARSER.escape(url).gsub(escape_regex) { |m| "%#{m.ord.to_s(16).upcase}" }
end
end
end