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.
14 lines
356 B
Ruby
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
|