/usr/share/perl5/URI/file/Unix.pm is in liburi-perl 1.59-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | package URI::file::Unix;
require URI::file::Base;
@ISA=qw(URI::file::Base);
use strict;
use URI::Escape qw(uri_unescape);
sub _file_extract_path
{
my($class, $path) = @_;
# tidy path
$path =~ s,//+,/,g;
$path =~ s,(/\.)+/,/,g;
$path = "./$path" if $path =~ m,^[^:/]+:,,; # look like "scheme:"
return $path;
}
sub _file_is_absolute {
my($class, $path) = @_;
return $path =~ m,^/,;
}
sub file
{
my $class = shift;
my $uri = shift;
my @path;
my $auth = $uri->authority;
if (defined($auth)) {
if (lc($auth) ne "localhost" && $auth ne "") {
$auth = uri_unescape($auth);
unless ($class->_file_is_localhost($auth)) {
push(@path, "", "", $auth);
}
}
}
my @ps = $uri->path_segments;
shift @ps if @path;
push(@path, @ps);
for (@path) {
# Unix file/directory names are not allowed to contain '\0' or '/'
return undef if /\0/;
return undef if /\//; # should we really?
}
return join("/", @path);
}
1;
|