mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(filemanager): return raw file content in FSRead to avoid embedded line numbers
The FSRead handler was using client.ReadFile() which formats each line with a line number prefix (for MCP AI tools). Switch to client.ReadRaw() so the file viewer gets unmodified content — fixes duplicate line numbers in the Monaco editor.
This commit is contained in:
@@ -256,15 +256,21 @@ func (h *ContainerdHandler) FSRead(c echo.Context) error {
|
||||
return echo.NewHTTPError(http.StatusServiceUnavailable, fmt.Sprintf("container not reachable: %v", err))
|
||||
}
|
||||
|
||||
resp, err := client.ReadFile(ctx, containerPath, 0, 0)
|
||||
rc, err := client.ReadRaw(ctx, containerPath)
|
||||
if err != nil {
|
||||
return fsHTTPError(err)
|
||||
}
|
||||
defer func() { _ = rc.Close() }()
|
||||
|
||||
data, err := io.ReadAll(rc)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "failed to read file")
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, FSReadResponse{
|
||||
Path: containerPath,
|
||||
Content: resp.GetContent(),
|
||||
Size: int64(len(resp.GetContent())),
|
||||
Content: string(data),
|
||||
Size: int64(len(data)),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user