From d8884726bf6ac1949a94135760760af4d5e59695 Mon Sep 17 00:00:00 2001
From: Alfred Persson Forsberg <cat@catcream.org>
Date: Mon, 29 Apr 2024 07:14:53 +0200
Subject: [PATCH] dns_njalla: fix record_id grep when removing record

Before remove-record would fail with
response='{"error": {"code": -32000, "message": "Invalid arguments"}, "jsonrpc": "2.0"}'
because record_id would always be empty.

Signed-off-by: Alfred Persson Forsberg <cat@catcream.org>
---
 dnsapi/dns_njalla.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dnsapi/dns_njalla.sh b/dnsapi/dns_njalla.sh
index e924328860..2d26a788f7 100644
--- a/dnsapi/dns_njalla.sh
+++ b/dnsapi/dns_njalla.sh
@@ -93,7 +93,7 @@ dns_njalla_rm() {
     echo "$records" | while read -r record; do
       record_name=$(echo "$record" | _egrep_o "\"name\":\s?\"[^\"]*\"" | cut -d : -f 2 | tr -d " " | tr -d \")
       record_content=$(echo "$record" | _egrep_o "\"content\":\s?\"[^\"]*\"" | cut -d : -f 2 | tr -d " " | tr -d \")
-      record_id=$(echo "$record" | _egrep_o "\"id\":\s?[0-9]+" | cut -d : -f 2 | tr -d " " | tr -d \")
+      record_id=$(echo "$record" | _egrep_o "\"id\":\s?\"[^\"]*\"" | cut -d : -f 2 | tr -d " " | tr -d \")
       if [ "$_sub_domain" = "$record_name" ]; then
         if [ "$txtvalue" = "$record_content" ]; then
           _debug "record_id" "$record_id"