From b06e6b033a5bb2f2b8ac834d1e672c4a18aee08a Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Thu, 18 Nov 2021 10:10:05 +0200 Subject: [PATCH] fix deprecation warning --- src/mechanize/http/agent.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mechanize/http/agent.cr b/src/mechanize/http/agent.cr index 1cb1458..7a94879 100644 --- a/src/mechanize/http/agent.cr +++ b/src/mechanize/http/agent.cr @@ -170,7 +170,11 @@ class Mechanize end # escape non-ascii character target_url = target_url.gsub(/[^#{0.chr}-#{126.chr}]/) { |match| - URI.encode(match) + {% if compare_versions(Crystal::VERSION, "1.1.1") > 0 %} + URI.encode_path(match) + {% else %} + URI.encode(match) + {% end %} } target_url = URI.parse(target_url) end