diff --git a/deploy-chunked-simple.sh b/deploy-chunked-simple.sh index 29e5c0e..1356181 100644 --- a/deploy-chunked-simple.sh +++ b/deploy-chunked-simple.sh @@ -211,14 +211,19 @@ upload_file_in_chunks() { echo "DEBUG: Uploading chunk to: $API_BASE/upload/chunk?uploadSessionId=$SESSION_ID&fileType=$file_type&chunkIndex=$chunk_index&totalChunks=$total_chunks&fileName=$file_name" fi - # Base64 encode the chunk so Java proxy can handle it as text/String + # Base64 encode the chunk to a temp file so Java proxy can handle it as text/String # This prevents corruption when proxy reads binary data as String - CHUNK_BASE64=$(base64 < "$chunk_file") + # Use temp file to avoid "Argument list too long" error + CHUNK_BASE64_FILE=$(mktemp) + base64 < "$chunk_file" > "$CHUNK_BASE64_FILE" RESPONSE=$(curl -s -X POST "$API_BASE/upload/chunk?uploadSessionId=$SESSION_ID&fileType=$file_type&chunkIndex=$chunk_index&totalChunks=$total_chunks&fileName=$file_name" \ -H "Content-Type: text/plain" \ -H "X-Chunk-Encoding: base64" \ - -d "$CHUNK_BASE64") + -d @"$CHUNK_BASE64_FILE") + + # Clean up temp file + rm -f "$CHUNK_BASE64_FILE" if [ "$DEBUG_MODE" = "true" ]; then echo "DEBUG: Chunk response: $RESPONSE"