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
bug(slm): File Browser downloads binary files as decoded text, corrupting them #21029
The SLM File Browser downloads every file as decoded text. Binary files (images, archives, PDFs) are corrupted on download.
Evidence (verified on origin/main by reading code; not reproduced in a running system)
autobot-slm-frontend/src/views/tools/admin/FileBrowserTool.vue lines 142-151 (downloadFile): const content = await api.readFile(filePath), then new Blob([content], { type: 'application/octet-stream' }), then an anchor click.
autobot-slm-frontend/src/composables/useAutobotApi.ts lines 842-847: readFile calls GET /files/read?path=... and returns response.content typed as string.
autobot-backend/api/files.py, route /read (admin_read_file, around line 1215): target.read_text(encoding="utf-8", errors="replace") returns {"content": content} (AdminFileReadResponse, autobot-backend/api/schemas_system.py:325). Non-UTF-8 bytes are replaced with U+FFFD on the server, so the original bytes never reach the browser.
No raw or binary route serves the admin browser's paths. The existing GET /api/files/download/{path} (autobot-backend/api/files.py:608) is scoped to the sandbox through validate_and_resolve_path. Whether it can serve admin paths is unverified.
Impact
Every binary file downloaded through File Browser is corrupted. Non-UTF-8 text is altered as well. Whole files also travel as JSON strings.
Acceptance criteria
Downloads fetch raw bytes: through an existing raw route if one can serve admin paths, otherwise through a streamed route.
Downloads save with the kit's saveBlob / saveResponse.
A test with a binary payload (including bytes that are invalid UTF-8, such as 0x89 0x50 0x4E 0x47 and 0xFF 0x00) shows the bytes are preserved end to end.
Closed with proof of implementation -- landed via #21087, train #21349, merge c5a3f23. Gate 2: check-issue-close-refs.sh 21029 -> clear.
"Downloads fetch raw bytes: through an existing raw route if one can serve admin paths, otherwise through a streamed route." -- met (code): autobot-backend/api/files_admin_raw.py:47 (admin-only router), :77 (_validate_admin_path, same validator as /read), :104-138 (StreamingResponse, bytes unmodified), mounted at core_routers.py:509.
"Downloads save with the kit's saveBlob / saveResponse." -- met (code): autobot-slm-frontend/src/composables/adminFileDownload.ts:14,25 (saveBlob(await response.blob(), filename)); FileBrowserTool.vue:145 calls it.
"A test with a binary payload (including invalid UTF-8 such as 0x89 0x50 0x4E 0x47 and 0xFF 0x00) shows the bytes are preserved end to end." -- met (code), in two halves: backend files_admin_raw_download_21029_test.py:20,70 (byte-exact), frontend adminFileDownload.test.ts:13,48 (saved bytes unchanged). Both passed in the train's CI run; no test spans server and browser together.
Not asserted: behaviour in a running browser/host (not an AC). Ratchets moved with it: hand-rolled save PIN 5, reach floor 421.
Closure audit against main 13685f3: closed as completed, work on main, but the 3 ACs are still unticked in the body. Evidence: autobot-backend/api/files_admin_raw.py (admin-only raw route), autobot-slm-frontend/src/composables/adminFileDownload.ts:14 saves via the kit's saveBlob, adminFileDownload.test.ts:8 uses an invalid-UTF-8 payload. Boxes left for the owner to tick.
ACs ticked with evidence on main: AC1 raw admin route autobot-backend/api/files_admin_raw.py; AC2 autobot-slm-frontend/src/composables/adminFileDownload.ts:14,25 saves via the kit's saveBlob; AC3 invalid-UTF-8 binary payloads in autobot-backend/tests/files_admin_raw_download_21029_test.py and adminFileDownload.test.ts.
Activity
github-actions commentedon Nov 7, 2026
needs-structurecleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).mrveiss commentedon Nov 7, 2026
Structure set per maintainer decision (2026-11-07): milestone M4, phase:M4.6, parent #20770.
chore(types): regenerate api types (#21029)
chore(files): run CI on the synced head (#21029)
Merge pull request #21092 from mrveiss/issue-files-admin-permission
github-actions commentedon Nov 7, 2026
Landed in #21092, merge
26dd86da0011 remaining items
fix(slm-frontend): add the file-download messages to every locale (#2…
github-actions commentedon Nov 12, 2026
Landed via the merge train (#21333, merge
19ebd20488)revert: restore the #21087 change that train #21333 reverted in place (…
chore(types): regenerate api.ts on the merged train tree (#21029)
fix(tests): read download bytes without assuming the test DOM's Blob …
fix(slm): File Browser downloads binary files byte-exact (mrveiss#21029)
fix(env): add the admin-files sibling import in the registry's existi…
fix(tests): lower the hand-rolled file save pin to 5 now the file bro…
fix(tests): re-pin the route-file reach floor mid-window for the new …
chore(types): regenerate api.ts for the raw download route (#21029)
github-actions commentedon Nov 12, 2026
Landed via the merge train (#21349, merge
c5a3f23f92)mrveiss commentedon Nov 12, 2026
Closed with proof of implementation -- landed via #21087, train #21349, merge c5a3f23. Gate 2:
check-issue-close-refs.sh 21029-> clear.autobot-backend/api/files_admin_raw.py:47(admin-only router),:77(_validate_admin_path, same validator as/read),:104-138(StreamingResponse, bytes unmodified), mounted atcore_routers.py:509.saveBlob/saveResponse." -- met (code):autobot-slm-frontend/src/composables/adminFileDownload.ts:14,25(saveBlob(await response.blob(), filename));FileBrowserTool.vue:145calls it.files_admin_raw_download_21029_test.py:20,70(byte-exact), frontendadminFileDownload.test.ts:13,48(saved bytes unchanged). Both passed in the train's CI run; no test spans server and browser together.Not asserted: behaviour in a running browser/host (not an AC). Ratchets moved with it: hand-rolled save PIN 5, reach floor 421.
mrveiss commentedon Nov 20, 2026
Closure audit against main 13685f3: closed as completed, work on main, but the 3 ACs are still unticked in the body. Evidence:
autobot-backend/api/files_admin_raw.py(admin-only raw route),autobot-slm-frontend/src/composables/adminFileDownload.ts:14saves via the kit'ssaveBlob,adminFileDownload.test.ts:8uses an invalid-UTF-8 payload. Boxes left for the owner to tick.mrveiss commentedon Nov 20, 2026
ACs ticked with evidence on main: AC1 raw admin route
autobot-backend/api/files_admin_raw.py; AC2autobot-slm-frontend/src/composables/adminFileDownload.ts:14,25saves via the kit'ssaveBlob; AC3 invalid-UTF-8 binary payloads inautobot-backend/tests/files_admin_raw_download_21029_test.pyandadminFileDownload.test.ts.