Skip to content

Commit 884e3ef

Browse files
committed
Re-figure File.open_file handling of the file scheme.
1 parent 71f70d5 commit 884e3ef

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/rdf/util/file.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ def http_adapter(use_net_http = false)
297297
# @yieldreturn [Object] returned from open_file
298298
# @raise [IOError] if not found
299299
def self.open_file(filename_or_url, proxy: nil, headers: {}, verify_none: false, **options, &block)
300-
filename_or_url = $1 if filename_or_url.to_s.match(/^file:(.*)$/)
301300
remote_document = nil
302301

303302
if filename_or_url.to_s.match?(/^https?/)

spec/util_file_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@
9898
expect(r).to be_a(RDF::Reader)
9999
end
100100

101+
it "yields a file scheme" do
102+
path = fixture_path("test.nt")
103+
path = Gem.win_platform? ? "file:/#{path}" : "file:#{path}"
104+
r = RDF::Util::File.open_file(path) do |f|
105+
expect(f).to respond_to(:read)
106+
opened.opened
107+
RDF::Reader.new
108+
end
109+
expect(r).to be_a(RDF::Reader)
110+
end
111+
101112
it "raises IOError on missing local file" do
102113
expect {RDF::Util::File.open_file(fixture_path("not-here"))}.to raise_error IOError
103114
opened.opened

0 commit comments

Comments
 (0)