From 47fdb738aa70895e426e79ac61e323bd698f03f1 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 7 Oct 2024 14:21:24 -0700 Subject: [PATCH] More file scheme URI normalization in Util::File.open_file. --- lib/rdf/util/file.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/rdf/util/file.rb b/lib/rdf/util/file.rb index 4264dac7..a4b8e4c8 100644 --- a/lib/rdf/util/file.rb +++ b/lib/rdf/util/file.rb @@ -319,6 +319,12 @@ def self.open_file(filename_or_url, proxy: nil, headers: {}, verify_none: false, url_no_frag_or_query.query = nil url_no_frag_or_query.fragment = nil options[:encoding] ||= Encoding::UTF_8 + + # Normalize a file scheme further + if url_no_frag_or_query.scheme == 'file' + url_no_frag_or_query = "file:///#{url_no_frag_or_query.path}" + end + Kernel.open(url_no_frag_or_query, "r", **options) do |file| document_options = { base_uri: filename_or_url.to_s,