mirror of https://github.com/digint/btrbk
btrbk: bugfix: vinfo(): correctly parse url, using check_url()
parent
357b72bd3f
commit
702ee8950e
31
btrbk
31
btrbk
|
@ -1432,27 +1432,30 @@ sub vinfo($;$)
|
||||||
my $config = shift;
|
my $config = shift;
|
||||||
my %info;
|
my %info;
|
||||||
|
|
||||||
my $name = $url;
|
my ($url_prefix, $path) = check_url($url);
|
||||||
|
die "invalid url: $url" unless(defined($path));
|
||||||
|
my $name = $path;
|
||||||
$name =~ s/^.*\///;
|
$name =~ s/^.*\///;
|
||||||
|
$name = '/' if($name eq "");
|
||||||
|
|
||||||
%info = (
|
%info = (
|
||||||
URL => $url,
|
URL => $url_prefix . $path,
|
||||||
NAME => $name,
|
NAME => $name,
|
||||||
PATH => $url,
|
PATH => $path,
|
||||||
PRINT => $url,
|
PRINT => $path,
|
||||||
URL_PREFIX => "",
|
URL_PREFIX => $url_prefix,
|
||||||
);
|
);
|
||||||
|
|
||||||
if($url =~ /^ssh:\/\/(\S+?)(\/\S+)$/) {
|
if($url_prefix) {
|
||||||
my ($host, $path) = ($1, $2);
|
my $host = $url_prefix;
|
||||||
|
die unless($host =~ s/^ssh:\/\///);
|
||||||
|
|
||||||
%info = (
|
%info = (
|
||||||
%info,
|
%info,
|
||||||
HOST => $host,
|
HOST => $host,
|
||||||
PATH => $path,
|
PRINT => "$host:$path",
|
||||||
PRINT => "$host:$path",
|
RSH_TYPE => "UNKNOWN",
|
||||||
URL_PREFIX => "ssh://$host",
|
RSH => [ '/bin/false' ],
|
||||||
RSH_TYPE => "UNKNOWN",
|
|
||||||
RSH => [ '/bin/false' ],
|
|
||||||
);
|
);
|
||||||
if($config) {
|
if($config) {
|
||||||
my $ssh_port = config_key($config, "ssh_port");
|
my $ssh_port = config_key($config, "ssh_port");
|
||||||
|
|
Loading…
Reference in New Issue