Skip to content

Commit

Permalink
More file scheme URI normalization in Util::File.open_file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Oct 7, 2024
1 parent 2b7c781 commit 47fdb73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/rdf/util/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 47fdb73

Please sign in to comment.