From 229ba47733e1102b0ff841c4ba5f1b29560db53f Mon Sep 17 00:00:00 2001 From: Indra Gunawan <1284811+coderbuzz@users.noreply.github.com> Date: Wed, 1 Jul 2026 17:18:46 +0700 Subject: [PATCH] fix: Input.Data []byte di-json-unmarshal sebagai base64, ganti ke string --- internal/http/console.go | 2 +- internal/ssh/client.go | 2 +- internal/ssh/interface.go | 2 +- internal/ssh/mock.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/http/console.go b/internal/http/console.go index 911b842..9810c4e 100644 --- a/internal/http/console.go +++ b/internal/http/console.go @@ -111,7 +111,7 @@ func (h *ConsoleHandler) ServeWS(w http.ResponseWriter, r *http.Request) { } } - inCh <- ssh.Input{Data: msg} + inCh <- ssh.Input{Data: string(msg)} } }() diff --git a/internal/ssh/client.go b/internal/ssh/client.go index db19b82..0bc399d 100644 --- a/internal/ssh/client.go +++ b/internal/ssh/client.go @@ -129,7 +129,7 @@ func (c *Client) Shell(ctx context.Context, rows, cols int) (<-chan Output, chan continue } if len(input.Data) > 0 { - wIn.Write(input.Data) + wIn.Write([]byte(input.Data)) } } }() diff --git a/internal/ssh/interface.go b/internal/ssh/interface.go index 629ec0d..4982c70 100644 --- a/internal/ssh/interface.go +++ b/internal/ssh/interface.go @@ -16,7 +16,7 @@ type WindowSize struct { } type Input struct { - Data []byte + Data string Resize *WindowSize } diff --git a/internal/ssh/mock.go b/internal/ssh/mock.go index 6d4810e..03ac0ee 100644 --- a/internal/ssh/mock.go +++ b/internal/ssh/mock.go @@ -73,7 +73,7 @@ func (m *MockClient) Shell(ctx context.Context, rows, cols int) (<-chan Output, if input.Resize != nil { continue } - for _, b := range input.Data { + for _, b := range []byte(input.Data) { if b == '\r' { outCh <- Output{Data: []byte("\r\n")} cmd := string(buf)