Skip to content

$URI::file::DEFAULT_AUTHORITY #92

@jackdeguest

Description

@jackdeguest

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.

As an example, consider:

perl -MURI -MURI::file::Win32 -lE 'say URI::file::Win32->new( q{C:\Documents\Some\Document.pdf} )'

would yield file://C:/Documents/Some/Document.pdf and calling path would rightfully produces /Documents/Some/Document.pdf

However, if I load URI::file, then look what happens:

perl -MURI -MURI::file -MURI::file::Win32 -lE 'say URI::file::Win32->new( q{C:\Documents\Some\Document.pdf} )->path'

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions