You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
View text files inline in the pod filesystem browser #1581
Radar’s Pod filesystem browser already lists and downloads files, but every file is forced to download. Operators cannot quickly inspect a small text configuration or log-like file in the UI.
Scope
Add an inline viewer for safe, size-bounded text files in the existing Pod filesystem browser. This is deliberately read-only; pod-file editing and upload are separate work.
Acceptance criteria
A user can open a supported text file in an inline viewer instead of downloading it.
Downloads remain available and unchanged.
Binary, oversized, or unreadable files show a clear fallback/error state rather than attempting to render.
The backend enforces a conservative size limit before buffering or returning content.
Preserve the existing pod-exec RBAC/capability gate.
Add focused backend and frontend tests for the supported, binary, oversized, and failure paths.
Interested in picking this up — coordinating on the two UX calls before writing code, as the issue asks.
My working assumptions (happy to adjust):
1. Size cap
Backend limit: 1 MiB, enforced as a hard cap on the streamed read (io.LimitReader) before buffering. HEAD-equivalent stat first so oversized files short-circuit with an explicit error instead of a truncated preview.
Frontend does not attempt to read past the cap.
2. What counts as "text"
Layered detection, applied server-side (never trust the extension alone):
Reject if stat shows size > cap.
Sniff the first 8 KiB with http.DetectContentType — accept text/*, application/json, application/xml, application/x-yaml.
Fallback heuristic for the unknown-MIME case (common with configs like nginx.conf that sniff as application/octet-stream): reject if any NUL byte appears in the first 8 KiB, otherwise accept as text/plain; charset=utf-8.
Binary or unreadable → structured error, frontend shows a "Preview not supported — download instead" fallback with the existing download action intact.
3. Encoding
UTF-8 only for v1. Non-UTF-8 falls through to the binary fallback. Explicit non-goal to detect/convert Latin-1 etc.
4. UX affordance
Existing row keeps its Download action; a "Preview" action opens the file in an inline read-only viewer (Monaco in read-only mode, since it's already wired up for YAML). No tail-follow in v1 — logs already have a dedicated viewer.
5. Backend shape
New `GET /api/pods/{ns}/{name}/file?container=&path=` returning `{content, encoding, truncated}` or a typed error. Reuses the existing pod-exec capability gate — no new authorization path. `HEAD` on the same route for the size/type probe.
Do these numbers/decisions match what you had in mind, or should I adjust the cap, the sniff set, or the endpoint shape before starting? Happy to change any of it.
Following up under the new CONTRIBUTING.md process — could I be assigned to this? Happy to proceed on the assumptions in my earlier comment (1 MiB cap, layered MIME + NUL-byte sniff, UTF-8 v1, Monaco read-only, GET /api/pods/{ns}/{name}/file), and equally happy to adjust any of them if you'd rather land somewhere different before I start.
yes, assigned - thanks!
suggestion sounds like a good start. try to test it in various scenarios to see that both the good and bad cases behave as intended (e.g. if you try to read a huge file, or a non-text file, or an empty file - that the UI makes sense, shows you errors that make it clear what happened - probably want curated error message rahter than only dumping raw error)
Activity
changyonggang commentedon Sep 4, 2026
Interested in picking this up — coordinating on the two UX calls before writing code, as the issue asks.
My working assumptions (happy to adjust):
1. Size cap
io.LimitReader) before buffering.HEAD-equivalent stat first so oversized files short-circuit with an explicit error instead of a truncated preview.2. What counts as "text"
statshows size > cap.http.DetectContentType— accepttext/*,application/json,application/xml,application/x-yaml.nginx.confthat sniff asapplication/octet-stream): reject if any NUL byte appears in the first 8 KiB, otherwise accept astext/plain; charset=utf-8.3. Encoding
4. UX affordance
5. Backend shape
Do these numbers/decisions match what you had in mind, or should I adjust the cap, the sniff set, or the endpoint shape before starting? Happy to change any of it.
docs: add a Claiming an Issue section to CONTRIBUTING (#1635)
changyonggang commentedon Sep 8, 2026
Following up under the new
CONTRIBUTING.mdprocess — could I be assigned to this? Happy to proceed on the assumptions in my earlier comment (1 MiB cap, layered MIME + NUL-byte sniff, UTF-8 v1, Monaco read-only,GET /api/pods/{ns}/{name}/file), and equally happy to adjust any of them if you'd rather land somewhere different before I start.nadaverell commentedon Sep 8, 2026
yes, assigned - thanks!
suggestion sounds like a good start. try to test it in various scenarios to see that both the good and bad cases behave as intended (e.g. if you try to read a huge file, or a non-text file, or an empty file - that the UI makes sense, shows you errors that make it clear what happened - probably want curated error message rahter than only dumping raw error)
feat(pod-file-browser): inline preview for size-bounded text files (#…