From ebbaccab53411bd9e884f8516d19511efb470db1 Mon Sep 17 00:00:00 2001
From: Axel Hahn <ax2002@gmx.net>
Date: Thu, 6 Jan 2022 19:59:10 +0100
Subject: [PATCH] update restic transfer: support https with auth

---
 plugins/transfer/restic.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh
index 79aebea..dba32a6 100644
--- a/plugins/transfer/restic.sh
+++ b/plugins/transfer/restic.sh
@@ -8,6 +8,7 @@
 # --------------------------------------------------------------------------------
 # ah - Axel Hahn <axel.hahn@iml.unibe.ch>
 # 2021-05-19  ah    v0.0   INIT ... WIP
+# 2022-01-06  ah    v0.0   added support for Repository with REST and authentication 
 # ================================================================================
 
 # --------------------------------------------------------------------------------
@@ -25,7 +26,16 @@
 
         # if we set RESTIC_REPOSITORY then "-r TARGET" is not 
         # needed in restic commands
-        export RESTIC_REPOSITORY=$( j_getFullTarget )
+
+        # TODO: for restic with https and auth - remove the host in the path
+        local _target=$( j_getFullTarget )
+        echo ${_target} | grep "https.*@" >/dev/null
+        if [ $? -eq 0 ]; then
+            local _host=$( hostname -f )
+            _target=$( echo $_target | sed "s#${_host}/##" )
+        fi
+
+        export RESTIC_REPOSITORY=$_target
 
         # WORKAROUND for bug while writing on a SMB target
         export GODEBUG="asyncpreemptoff=1"
-- 
GitLab