From 58188b6fea8adc325b8caa7451645af5e168577b Mon Sep 17 00:00:00 2001 From: tocmo0nlord Date: Sun, 26 Apr 2026 00:27:15 +0000 Subject: [PATCH] fix: handle text+bytes in terminal WS; mkdir -p before SFTP upload; robust conda path detection --- backend/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index 4891bef..e48d11f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,4 +1,4 @@ -import asyncio +import asyncio import json import os import tempfile @@ -368,8 +368,11 @@ async def ws_terminal(websocket: WebSocket): async def ws_to_ssh(): try: while True: - data = await websocket.receive_bytes() - channel.send(data) + msg = await websocket.receive() + if "bytes" in msg and msg["bytes"]: + channel.send(msg["bytes"]) + elif "text" in msg and msg["text"]: + channel.send(msg["text"].encode()) except WebSocketDisconnect: pass