Fix critical UI and data export issues #327

Merged
ZacharyZcR merged 4 commits from main into dev-1.7.1 2025-10-02 21:29:37 +00:00
Showing only changes of commit a097b1e300 - Show all commits
+12 -1
View File
@@ -427,7 +427,18 @@ wss.on("connection", async (ws: WebSocket, req) => {
sshStream = stream; sshStream = stream;
stream.on("data", (data: Buffer) => { stream.on("data", (data: Buffer) => {
ws.send(JSON.stringify({ type: "data", data: data.toString() })); let decoded = data.toString("utf-8");
// Defensive fallback: if UTF-8 decode produces replacement characters
// and buffer contains high bytes, try latin1 (for legacy servers without UTF-8 locale)
if (
decoded.includes("\uFFFD") &&
data.some((byte) => byte >= 0x80 && byte <= 0xff)
) {
decoded = data.toString("latin1");
}
ws.send(JSON.stringify({ type: "data", data: decoded }));
}); });
stream.on("close", () => { stream.on("close", () => {