From 92d2c4b96c7fc2c2d8b293804321f9a3181aee48 Mon Sep 17 00:00:00 2001 From: crwenner Date: Thu, 29 Oct 2020 15:12:10 -0400 Subject: [PATCH] Update gem to fix for obsolete URI escape and unescape methods In order to remove the warnings about the use of URI#unescape and URI#escape, this pull request updates the mentioned methods to use `URI::DEFAULT_PARSER`. --- lib/http_router/generator.rb | 6 +++--- lib/http_router/request.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/http_router/generator.rb b/lib/http_router/generator.rb index 51d6d8c..d555a80 100644 --- a/lib/http_router/generator.rb +++ b/lib/http_router/generator.rb @@ -36,13 +36,13 @@ def initialize(route, path, validation_regex = nil) instance_eval <<-EOT, __FILE__, __LINE__ + 1 def generate(args, options) generated_path = \"#{code}\" - #{validation_regex.inspect}.match(generated_path) ? URI.escape(generated_path) : nil + #{validation_regex.inspect}.match(generated_path) ? URI::DEFAULT_PARSER.escape(generated_path) : nil end EOT else instance_eval <<-EOT, __FILE__, __LINE__ + 1 def generate(args, options) - URI.escape(\"#{code}\") + URI::DEFAULT_PARSER.escape(\"#{code}\") end EOT end @@ -147,4 +147,4 @@ def append_querystring(uri, params) uri end end -end \ No newline at end of file +end diff --git a/lib/http_router/request.rb b/lib/http_router/request.rb index f5c9d64..1c1af62 100644 --- a/lib/http_router/request.rb +++ b/lib/http_router/request.rb @@ -7,7 +7,7 @@ class Request def initialize(path, rack_request) @rack_request = rack_request - @path = URI.unescape(path).split(/\//) + @path = URI::DEFAULT_PARSER.unescape(path).split(/\//) @path.shift if @path.first == '' @path.push('') if path[-1] == ?/ @extra_env = {} @@ -27,4 +27,4 @@ def path_finished? @path.size == 0 or @path.size == 1 && @path.first == '' end end -end \ No newline at end of file +end