This commit is contained in:
pratik
2025-10-22 13:26:14 -05:00
parent 4db1285f88
commit 4c2f46a725

View File

@@ -205,6 +205,13 @@ upload_file_in_chunks() {
for chunk_file in "$temp_dir"/chunk_*; do for chunk_file in "$temp_dir"/chunk_*; do
printf " Chunk %3d/%3d... " "$((chunk_index + 1))" "$total_chunks" 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" \ RESPONSE=$(curl -s -X POST "$API_BASE/upload/chunk" \
-F "uploadSessionId=$SESSION_ID" \ -F "uploadSessionId=$SESSION_ID" \
-F "fileType=$file_type" \ -F "fileType=$file_type" \
@@ -213,11 +220,20 @@ upload_file_in_chunks() {
-F "fileName=$file_name" \ -F "fileName=$file_name" \
-F "chunk=@$chunk_file") -F "chunk=@$chunk_file")
if [ "$DEBUG_MODE" = "true" ]; then
echo "DEBUG: Chunk response: $RESPONSE"
fi
SUCCESS=$(echo "$RESPONSE" | grep -o '"success":[^,}]*' | cut -d':' -f2) SUCCESS=$(echo "$RESPONSE" | grep -o '"success":[^,}]*' | cut -d':' -f2)
if [ "$SUCCESS" != "true" ]; then if [ "$SUCCESS" != "true" ]; then
echo -e "${RED}FAILED${NC}" echo -e "${RED}FAILED${NC}"
log_error "Failed to upload chunk $((chunk_index + 1))/$total_chunks" 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" echo "$RESPONSE"
rm -rf "$temp_dir" rm -rf "$temp_dir"
exit 1 exit 1