From a75f49f1271f4dffe06af40d1264d3185929ff71 Mon Sep 17 00:00:00 2001 From: iqre8 <57012516+iqre8@users.noreply.github.com> Date: Sun, 14 Mar 2021 09:26:10 -0300 Subject: [PATCH 1/2] Update url_generator.rb undefined method `escape' for URI:Module with Ruby 3.0.0 This method is obsolete and should not be used. Instead, use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case. --- lib/paperclip/url_generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/paperclip/url_generator.rb b/lib/paperclip/url_generator.rb index 83f784979..f6547ef1f 100644 --- a/lib/paperclip/url_generator.rb +++ b/lib/paperclip/url_generator.rb @@ -65,7 +65,7 @@ def escape_url(url) if url.respond_to?(:escape) url.escape else - URI.escape(url).gsub(escape_regex){|m| "%#{m.ord.to_s(16).upcase}" } + URI.encode_www_form_component(url).gsub(escape_regex){|m| "%#{m.ord.to_s(16).upcase}" } end end From 22721c7cdc2304ba9b29f2500238c8c34643c1b1 Mon Sep 17 00:00:00 2001 From: iqre8 <57012516+iqre8@users.noreply.github.com> Date: Mon, 15 Mar 2021 08:30:55 -0300 Subject: [PATCH 2/2] Update url_generator.rb Layout/SpaceBeforeBlockBraces: Space missing to the left of {. Layout/SpaceInsideBlockBraces: Space between { and | missing. Metrics/LineLength: Line is too long. [95/80] --- lib/paperclip/url_generator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/paperclip/url_generator.rb b/lib/paperclip/url_generator.rb index f6547ef1f..b82e6cffd 100644 --- a/lib/paperclip/url_generator.rb +++ b/lib/paperclip/url_generator.rb @@ -65,7 +65,9 @@ def escape_url(url) if url.respond_to?(:escape) url.escape else - URI.encode_www_form_component(url).gsub(escape_regex){|m| "%#{m.ord.to_s(16).upcase}" } + URI.encode_www_form_component(url).gsub(escape_regex) { + |m| "%#{m.ord.to_s(16).upcase}" + } end end