From cbb16e3ecd89858213e11fa9ffaeb6f186849792 Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Mon, 15 Mar 2021 10:47:22 -0400 Subject: [PATCH] Uri escape (#525) * Address URI.escape and URI.unescape deprecation to clean up logs - Update solr_wrapper and fcrepo_wrapper gems in order to be able to run tests locally Co-authored-by: fnibbit Co-authored-by: Chris Colvard Co-authored-by: Chris Colvard --- .../app/models/hydra/access_controls/permission.rb | 7 +++++-- hydra-head.gemspec | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hydra-access-controls/app/models/hydra/access_controls/permission.rb b/hydra-access-controls/app/models/hydra/access_controls/permission.rb index cf957d803..0f5897726 100644 --- a/hydra-access-controls/app/models/hydra/access_controls/permission.rb +++ b/hydra-access-controls/app/models/hydra/access_controls/permission.rb @@ -41,7 +41,7 @@ def assign_attributes(attributes) end def agent_name - URI.decode(parsed_agent.last) + URI.decode_www_form_component(parsed_agent.last) end def update(*) @@ -79,8 +79,11 @@ def build_agent(name, type) end end + # The current URL.hash standard (As of March 2021) is that the post-hash portion of the URL is not percent-decoded + # however in order to ensure backward compatibility with already recorded values we are normalizing + # the fragment here. See https://developer.mozilla.org/en-US/docs/Web/API/URL/hash def build_agent_resource(prefix, name) - [Agent.new(::RDF::URI.new("#{prefix}##{URI.encode(name)}"))] + [Agent.new(::RDF::URI.new("#{prefix}##{URI.encode(name)}").normalize!)] end def build_access(access) diff --git a/hydra-head.gemspec b/hydra-head.gemspec index 9f4a8122f..9a924291e 100644 --- a/hydra-head.gemspec +++ b/hydra-head.gemspec @@ -18,14 +18,14 @@ Gem::Specification.new do |s| s.add_dependency 'hydra-access-controls', version s.add_dependency 'hydra-core', version - s.add_dependency 'rails', '>= 5.2', '< 6.1' + s.add_dependency 'rails', '>= 5.2.4', '< 6.1' s.add_development_dependency 'coveralls' s.add_development_dependency 'engine_cart', '~> 2.2' s.add_development_dependency 'factory_bot' - s.add_development_dependency 'fcrepo_wrapper', '~> 0.6' + s.add_development_dependency 'fcrepo_wrapper', '~> 0.9' s.add_development_dependency 'rspec-rails' s.add_development_dependency 'simplecov' - s.add_development_dependency 'solr_wrapper', '~> 0.18' + s.add_development_dependency 'solr_wrapper', '~> 3' s.add_development_dependency 'rspec_junit_formatter' end