diff --git a/pkg/dmsgpty/ui.go b/pkg/dmsgpty/ui.go index 8315f507..bcdc1ae8 100644 --- a/pkg/dmsgpty/ui.go +++ b/pkg/dmsgpty/ui.go @@ -136,7 +136,8 @@ func (ui *UI) Handler(customCommands map[string][]string) http.HandlerFunc { } defer func() { log.WithError(ws.Close(websocket.StatusNormalClosure, "closed")).Debug("Closed ws.") }() - wsConn := websocket.NetConn(r.Context(), ws, websocket.MessageText) + // Use binary mode for PTY data - text mode fails on non-UTF-8 bytes + wsConn := websocket.NetConn(r.Context(), ws, websocket.MessageBinary) // open pty logWS(wsConn, "Dialing...") diff --git a/pkg/dmsgpty/ui_html.go b/pkg/dmsgpty/ui_html.go index 841ca793..084efa10 100644 --- a/pkg/dmsgpty/ui_html.go +++ b/pkg/dmsgpty/ui_html.go @@ -4318,7 +4318,6 @@ func writeTermHTML(w io.Writer) (int64, error) { if err != nil { return 0, err } - defer gz.Close() //nolint - return io.Copy(w, gz) //nolint:gosec // HTML is trusted content + return io.Copy(w, gz) //nolint:gosec // G110: embedded content is trusted }