1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
From: Daniel Leidert <dleidert@debian.org>
Date: Mon, 22 Nov 2021 02:17:30 +0100
Subject: Use URI.open and fix FTBFS with Ruby 3.0
Bug-Debian: https://bugs.debian.org/996304
Forwarded: https://github.com/voxpupuli/json-schema/pull/459
---
lib/json-schema/schema/reader.rb | 2 +-
lib/json-schema/validator.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/json-schema/schema/reader.rb b/lib/json-schema/schema/reader.rb
index a4eb664..b0c5433 100644
--- a/lib/json-schema/schema/reader.rb
+++ b/lib/json-schema/schema/reader.rb
@@ -118,7 +118,7 @@ module JSON
def read_uri(uri)
if accept_uri?(uri)
- open(uri.to_s).read
+ URI.open(uri.to_s).read
else
raise JSON::Schema::ReadRefused.new(uri.to_s, :uri)
end
diff --git a/lib/json-schema/validator.rb b/lib/json-schema/validator.rb
index c439b61..da739fb 100644
--- a/lib/json-schema/validator.rb
+++ b/lib/json-schema/validator.rb
@@ -593,7 +593,7 @@ module JSON
uri = Util::URI.normalized_uri(uri) if uri.is_a?(String)
if uri.absolute? && Util::URI::SUPPORTED_PROTOCOLS.include?(uri.scheme)
begin
- open(uri.to_s).read
+ URI.open(uri.to_s).read
rescue OpenURI::HTTPError, Timeout::Error => e
raise JSON::Schema::JsonLoadError, e.message
end
|