From ebc8e37f8a771a3a5c13474a382093472d8d5cfd Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Wed, 31 Jan 2024 10:06:03 +0100
Subject: [PATCH] fix replace of fqdn

---
 plugins/transfer/restic.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh
index be5b4d3..0b8b3b9 100644
--- a/plugins/transfer/restic.sh
+++ b/plugins/transfer/restic.sh
@@ -18,6 +18,7 @@
 # 2022-11-04  ah    v1.0   one command for forget and prune; rename hooks
 # 2023-03-20  ah    v1.1   use vss for backup on MS Windows
 # 2024-01-23  ah    v1.2   prune uses --max-unused unlimited
+# 2024-01-31  ah    v1.3   fix replace of fqdn
 # ================================================================================
 
 # --------------------------------------------------------------------------------
@@ -38,9 +39,9 @@
 
         # 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
-            _target=$( echo $_target | sed "s#${FQDN}/##" )
+        if grep "^rest:http.*@" <<< "${_target}" >/dev/null; then
+            local _regex=${FQDN//\./\\.}
+            _target=$( echo $_target | sed "s#${_regex}/##" )
         fi
 
         export RESTIC_REPOSITORY=$_target
-- 
GitLab