mirror of https://github.com/digint/btrbk
btrbk: bugfix: handle corner case: url="ssh://my.host" (without trailing slash)
As we allow <url> to be specified as "<hostname>:<directory>", an URL "ssh://my.host" (without trailing slash) was parsed as hostname="ssh", directory="/my.host".pull/245/head
parent
c2022a5b2f
commit
669a34357a
3
btrbk
3
btrbk
|
@ -3145,9 +3145,12 @@ sub check_url($;@)
|
||||||
my %opts = @_;
|
my %opts = @_;
|
||||||
my $url_prefix = "";
|
my $url_prefix = "";
|
||||||
|
|
||||||
|
if($url =~ /^ssh:\/\//) {
|
||||||
if($url =~ s/^(ssh:\/\/($ip_addr_match|$host_name_match))\//\//) {
|
if($url =~ s/^(ssh:\/\/($ip_addr_match|$host_name_match))\//\//) {
|
||||||
$url_prefix = $1;
|
$url_prefix = $1;
|
||||||
}
|
}
|
||||||
|
# if no match, treat it as file and let check_file() print errors
|
||||||
|
}
|
||||||
elsif($url =~ s/^($ip_addr_match|$host_name_match)://) {
|
elsif($url =~ s/^($ip_addr_match|$host_name_match)://) {
|
||||||
# convert "my.host.com:/my/path" to ssh url
|
# convert "my.host.com:/my/path" to ssh url
|
||||||
$url_prefix = "ssh://" . $1;
|
$url_prefix = "ssh://" . $1;
|
||||||
|
|
Loading…
Reference in New Issue