From 669a34357aaaf6050a0455bfb94f3afcdea4670c Mon Sep 17 00:00:00 2001 From: Axel Burri Date: Mon, 9 Jul 2018 16:13:48 +0200 Subject: [PATCH] btrbk: bugfix: handle corner case: url="ssh://my.host" (without trailing slash) As we allow to be specified as ":", an URL "ssh://my.host" (without trailing slash) was parsed as hostname="ssh", directory="/my.host". --- btrbk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/btrbk b/btrbk index 8f025b3..13f328a 100755 --- a/btrbk +++ b/btrbk @@ -3145,8 +3145,11 @@ sub check_url($;@) my %opts = @_; my $url_prefix = ""; - if($url =~ s/^(ssh:\/\/($ip_addr_match|$host_name_match))\//\//) { - $url_prefix = $1; + if($url =~ /^ssh:\/\//) { + if($url =~ s/^(ssh:\/\/($ip_addr_match|$host_name_match))\//\//) { + $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)://) { # convert "my.host.com:/my/path" to ssh url