diff --git a/deploy-chunked-simple.sh b/deploy-chunked-simple.sh index aa2c399..db9e120 100644 --- a/deploy-chunked-simple.sh +++ b/deploy-chunked-simple.sh @@ -205,6 +205,13 @@ upload_file_in_chunks() { for chunk_file in "$temp_dir"/chunk_*; do printf " Chunk %3d/%3d... " "$((chunk_index + 1))" "$total_chunks" + if [ "$DEBUG_MODE" = "true" ]; then + echo "" + echo "DEBUG: SESSION_ID='$SESSION_ID'" + echo "DEBUG: Uploading to: $API_BASE/upload/chunk" + fi + + # Send all params as form fields with the multipart file RESPONSE=$(curl -s -X POST "$API_BASE/upload/chunk" \ -F "uploadSessionId=$SESSION_ID" \ -F "fileType=$file_type" \ @@ -213,11 +220,20 @@ upload_file_in_chunks() { -F "fileName=$file_name" \ -F "chunk=@$chunk_file") + if [ "$DEBUG_MODE" = "true" ]; then + echo "DEBUG: Chunk response: $RESPONSE" + fi + SUCCESS=$(echo "$RESPONSE" | grep -o '"success":[^,}]*' | cut -d':' -f2) if [ "$SUCCESS" != "true" ]; then echo -e "${RED}FAILED${NC}" log_error "Failed to upload chunk $((chunk_index + 1))/$total_chunks" + echo "DEBUG: SESSION_ID='$SESSION_ID'" + echo "DEBUG: fileType='$file_type'" + echo "DEBUG: chunkIndex='$chunk_index'" + echo "DEBUG: totalChunks='$total_chunks'" + echo "DEBUG: fileName='$file_name'" echo "$RESPONSE" rm -rf "$temp_dir" exit 1