You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When URI::file is loaded then calling, for example, URI::file::Win32->new( q{C:\Documents\Some\Document.pdf} ) will not work as expected, because URI::file::Win32->_file_extract_authority has a condition whether $URI::file::DEFAULT_AUTHORITY is defined and $URI::file::DEFAULT_AUTHORITY is set in URI::file to an empty string, hence defined, thus the condition always returns true if URI::file is loaded.
Undefining the default authority (regardless whether in URI::file or URI::file::Win32) breaks t/file.t:
t/file.t ..
1..12
ok 1
URI::file->new('/foo/bar', 'unix') ne file:///foo/bar, but file:/foo/bar
URI::file->new('\foo\bar', 'win32') ne file:///foo/bar, but file:/foo/bar
not ok 2
ok 3
ok 4
ok 5
ok 6
URI::file->new('/A:/', 'unix') ne file:///A:/, but file:/A:/
URI::file->new('A:\', 'win32') ne file:///A:/, but file://A:/
not ok 7
URI::file->new('/', 'unix') ne file:///, but file:/
URI::file->new('\', 'win32') ne file:///, but file:/
not ok 8
ok 9
ok 10
ok 11
ok 12
Failed 3/12 subtests
Test Summary Report
-------------------
t/file.t (Wstat: 0 Tests: 12 Failed: 3)
Failed tests: 2, 7-8
When
URI::file
is loaded then calling, for example,URI::file::Win32->new( q{C:\Documents\Some\Document.pdf} )
will not work as expected, becauseURI::file::Win32->_file_extract_authority
has a condition whether$URI::file::DEFAULT_AUTHORITY
is defined and$URI::file::DEFAULT_AUTHORITY
is set inURI::file
to an empty string, hence defined, thus the condition always returns true ifURI::file
is loaded.As an example, consider:
would yield
file://C:/Documents/Some/Document.pdf
and callingpath
would rightfully produces/Documents/Some/Document.pdf
However, if I load URI::file, then look what happens:
This would yield:
file:///C:/Documents/Some/Document.pdf
and calling path would produce:/C:/Documents/Some/Document.pdf
The recommended solution would be to set the value of
$URI::file::DEFAULT_AUTHORITY
to undef, or leave it undefined and then it would work.The text was updated successfully, but these errors were encountered: