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"
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"