From bbed49316136e2c7f53e61b9420b1fabb8593812 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Wed, 5 Nov 2025 14:21:35 -0800 Subject: [PATCH] Stop using obsolete URI.regexp for validation --- lib/iiif/v3/abstract_resource.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/iiif/v3/abstract_resource.rb b/lib/iiif/v3/abstract_resource.rb index c451d8e..d8a1efe 100644 --- a/lib/iiif/v3/abstract_resource.rb +++ b/lib/iiif/v3/abstract_resource.rb @@ -472,11 +472,12 @@ def define_accessor_methods(*keys, &validation) end private + def validate_uri(val, key) - unless val.kind_of?(String) && val =~ /\A#{URI::regexp}\z/ - m = "#{key} value must be a String containing a URI for #{self.class}" - raise IIIF::V3::Presentation::IllegalValueError, m - end + raise ArgumentError if URI(val).scheme.nil? + rescue URI::Error, ArgumentError + m = "#{key} value must be a String containing a URI for #{self.class}" + raise IIIF::V3::Presentation::IllegalValueError, m end end