From 8549eb999aff49fed0054ef4839f731eb48fa2cc Mon Sep 17 00:00:00 2001
From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
Date: Fri, 21 Feb 2025 18:00:01 +0100
Subject: [PATCH] Resolve issue when double quotes are part of the description

---
 checking_conflicts.sh | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/checking_conflicts.sh b/checking_conflicts.sh
index d161861..cf0998f 100644
--- a/checking_conflicts.sh
+++ b/checking_conflicts.sh
@@ -67,20 +67,21 @@ if [ ${3} == "all" ] ; then
 else
   merge_requests=$(curl "${1}/projects/${2}/merge_requests?state=opened&milestone=${3}&target_branch=${4}")
 fi
-echo "${merge_requests}" | jq -c '.[]' | while read mr; do
-  mr_id=$(echo "$mr" | jq '.iid')
+
+printf '%s' "${merge_requests}" | jq -c '.[]' | while read -r mr; do
+  mr_id=$(printf '%s' "$mr" | jq -r '.iid')
   result_id=$?
   if [ ! $result_id == 0 ] ; then
     echo "ERROR: When retrieving merge request id"
     continue
   fi
-  mr_title=$(echo "$mr" | jq '.title')
+  mr_title=$(printf '%s' "$mr" | jq -r '.title')
   result_title=$?
   if [ ! $result_title == 0 ] ; then
     echo "ERROR: When retrieving merge request title"
     continue
   fi
-  mr_source_branch=$(echo "$mr" | jq -r '.source_branch')
+  mr_source_branch=$(printf '%s' "$mr" | jq -r '.source_branch')
   result_source_branch=$?
   if [ ! $result_source_branch == 0 ] ; then
     echo "ERROR: When retrieving merge request source branch"
-- 
GitLab