From 39490de3bdda3cb0b3aed16544b38b3771fbcca7 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 19 Dec 2022 21:16:29 +0100 Subject: [PATCH] Make the URI tests pass with ruby-head * host is "" instead of nil, following the upstream change: https://github.com/ruby/uri/commit/81263c9e94bd67ca01deee238842a88c2c8885f3 --- lib/sprockets/uri_utils.rb | 2 +- test/test_uri_utils.rb | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/sprockets/uri_utils.rb b/lib/sprockets/uri_utils.rb index 57ab184d9..85da4a1d6 100644 --- a/lib/sprockets/uri_utils.rb +++ b/lib/sprockets/uri_utils.rb @@ -53,7 +53,7 @@ def split_file_uri(uri) path = path[1..-1] end - [scheme, host, path, query] + [scheme, host || '', path, query] end # Internal: Join file: URI component parts into String. diff --git a/test/test_uri_utils.rb b/test/test_uri_utils.rb index 8a0e2a5e3..f3b946d47 100644 --- a/test/test_uri_utils.rb +++ b/test/test_uri_utils.rb @@ -39,23 +39,23 @@ def test_split_file_uri assert_equal ['file', 'localhost', '/etc/fstab', nil], parts parts = split_file_uri("file:///etc/fstab") - assert_equal ['file', nil, '/etc/fstab', nil], parts + assert_equal ['file', '', '/etc/fstab', nil], parts parts = split_file_uri("file:///usr/local/bin/ruby%20on%20rails") - assert_equal ['file', nil, '/usr/local/bin/ruby on rails', nil], parts + assert_equal ['file', '', '/usr/local/bin/ruby on rails', nil], parts parts = split_file_uri("file:///usr/local/var/github/app/assets/javascripts/application.js") - assert_equal ['file', nil, '/usr/local/var/github/app/assets/javascripts/application.js', nil], parts + assert_equal ['file', '', '/usr/local/var/github/app/assets/javascripts/application.js', nil], parts if DOSISH parts = split_file_uri("file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc") - assert_equal ['file', nil, 'C:/Documents and Settings/davris/FileSchemeURIs.doc', nil], parts + assert_equal ['file', '', 'C:/Documents and Settings/davris/FileSchemeURIs.doc', nil], parts parts = split_file_uri("file:///D:/Program%20Files/Viewer/startup.htm") - assert_equal ['file', nil, 'D:/Program Files/Viewer/startup.htm', nil], parts + assert_equal ['file', '', 'D:/Program Files/Viewer/startup.htm', nil], parts parts = split_file_uri("file:///C:/Program%20Files/Music/Web%20Sys/main.html?REQUEST=RADIO") - assert_equal ['file', nil, 'C:/Program Files/Music/Web Sys/main.html', 'REQUEST=RADIO'], parts + assert_equal ['file', '', 'C:/Program Files/Music/Web Sys/main.html', 'REQUEST=RADIO'], parts end end