This commit is contained in:
pratik
2025-10-22 11:55:12 -05:00
parent 401d53da50
commit ab07cd6d92

View File

@@ -158,31 +158,38 @@ if [ "$DEBUG_MODE" = "true" ]; then
echo "$CF_CONFIG" echo "$CF_CONFIG"
fi fi
# Write JSON to temporary file to avoid quote escaping issues
TEMP_JSON=$(mktemp)
echo "$CF_CONFIG" > "$TEMP_JSON"
# Build the curl command # Build the curl command
if [ -n "$CURL_OPTS" ]; then if [ -n "$CURL_OPTS" ]; then
if [ "$DEBUG_MODE" = "true" ]; then if [ "$DEBUG_MODE" = "true" ]; then
INIT_RESPONSE=$(eval curl -v -X POST "$API_BASE/upload/init" \ INIT_RESPONSE=$(eval curl -v -X POST "$API_BASE/upload/init" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
$CURL_OPTS \ $CURL_OPTS \
-d "'$CF_CONFIG'") -d @"$TEMP_JSON")
else else
INIT_RESPONSE=$(eval curl -s -X POST "$API_BASE/upload/init" \ INIT_RESPONSE=$(eval curl -s -X POST "$API_BASE/upload/init" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
$CURL_OPTS \ $CURL_OPTS \
-d "'$CF_CONFIG'") -d @"$TEMP_JSON")
fi fi
else else
if [ "$DEBUG_MODE" = "true" ]; then if [ "$DEBUG_MODE" = "true" ]; then
INIT_RESPONSE=$(curl -v -X POST "$API_BASE/upload/init" \ INIT_RESPONSE=$(curl -v -X POST "$API_BASE/upload/init" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$CF_CONFIG") -d @"$TEMP_JSON")
else else
INIT_RESPONSE=$(curl -s -X POST "$API_BASE/upload/init" \ INIT_RESPONSE=$(curl -s -X POST "$API_BASE/upload/init" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$CF_CONFIG") -d @"$TEMP_JSON")
fi fi
fi fi
# Clean up temporary file
rm -f "$TEMP_JSON"
CURL_EXIT_CODE=$? CURL_EXIT_CODE=$?
if [ "$DEBUG_MODE" = "true" ]; then if [ "$DEBUG_MODE" = "true" ]; then
echo "DEBUG: Curl exit code: $CURL_EXIT_CODE" echo "DEBUG: Curl exit code: $CURL_EXIT_CODE"