Merge pull request #17 from mamantoha/fix-warning

fix deprecation warning
master
Kanezoh 2021-11-19 14:26:24 +09:00 committed by GitHub
commit cbe59ceae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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