From 626ac2a0c5e49ba9f7e9ab4f0167cabc468729e9 Mon Sep 17 00:00:00 2001 From: Phlogi Date: Mon, 26 Oct 2020 07:56:58 +0100 Subject: [PATCH] Fix URI parsing Tested only for sftp. Without the leading ..// the System.Uri will fail on the next line, as the string is empty. --- backup.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup.ps1 b/backup.ps1 index 60a05cf..8a8db22 100644 --- a/backup.ps1 +++ b/backup.ps1 @@ -244,7 +244,7 @@ function Invoke-ConnectivityCheck { else { # parse connection string for hostname # Uri parser doesn't handle leading connection type info (s3:, sftp:, rest:) - $connection_string = $env:RESTIC_REPOSITORY -replace "^s3:" -replace "^sftp:" -replace "^rest:" + $connection_string = $env:RESTIC_REPOSITORY -replace "^s3:","s3://" -replace "^sftp:","sftp://" -replace "^rest:","rest://" $repository_host = ([System.Uri]$connection_string).host } @@ -364,4 +364,4 @@ function Invoke-Main { exit $error_count } -Invoke-Main \ No newline at end of file +Invoke-Main