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