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.
This commit is contained in:
13
config/initializers/paperclip.rb
Normal file
13
config/initializers/paperclip.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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
|
||||||
Reference in New Issue
Block a user