Repository navigation
feat(uploads): prompt uploads accept .html and .htm as documents - #869
Conversation
AI tools write specifications, reports and plans as HTML as often as Markdown, and handing one to a session as context is the same job as attaching a .md. Paste, drop and every Attach picker refused them with "Unsupported file type". .html/.htm join the text family (UTF-8, no NUL byte) on the server and in every browser copy the parity test pins. An upload is stored to be read, never rendered on Codeman's origin: file-raw serves it as octet-stream with nosniff and html-view refuses a page under .codeman-uploads, both now pinned by tests. Scripts (.sh, .py, .js) are still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @ludovicfourrage. This PR lets paste, drop and every Attach picker take The code change is clean. The server list, Three places in the docs still describe the old refusal:
If you push those three edits, this is ready to merge. If not, they can be applied at merge time. |
api-reference limits the refused example to scripts and says html/htm are admitted and inert, leaving svg as the markup type kept out. architecture-invariants lists html/htm in the text family and drops html from the scope exclusion, as CLAUDE.md does. The wiki says the File Viewer shows an uploaded page's source, which is what a click on its path does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Pushed 5374d02 with the three doc edits:
I searched the rest of the repo for the old wording and found no other place. Thanks also for the correction on #868: both protections predate the list, so this PR revisits the #553 call rather than following a code change. I've reworded the PR description to say so. The case for revisiting it is how these files are used. AI tools write specifications, reports and plans as Markdown or as HTML, and a user hands one to a session as context the same way as a |
|
Thanks for the quick follow-up, @ludovicfourrage. This PR lets paste, drop and every Attach picker take All three doc edits from the last round are in. One wording fix goes in at merge time. This is ready to merge. |
The Prompt uploads paragraph said the server keeps out what it "would run"; the scope exclusion keeps out what an agent could run, the phrase docs/api-reference.md and docs/architecture-invariants.md already use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged, and shipped in Codeman 1.52.1. This closes #868. One wording fix went on top, as the review said: the Prompt uploads paragraph in Thanks for making the case for revisiting the old call, and for pinning both protections with tests. |
Fixes #868.
Prompt uploads accept
.htmland.htmas documents. AI tools write specifications, reports and plans as HTML as often as Markdown, and handing one to a session as context is the same job as attaching a.md. Until now paste, drop and every Attach picker refused them with "Unsupported file type".What changes:
TEXT_UPLOAD_EXTSinsession-routes.tsgains.htmland.htm, so they joinALLOWED_DOCUMENT_EXTSand are judged like the rest of the text family: valid UTF-8 with no NUL byte, saved to.codeman-uploads/under a cleaned-up copy of their name._promptAttachKindinimage-input.js, theaccept=of#attachFileInputinindex.html, and both.paste-file-inputpickers inkeyboard-accessory.js. The file-path link patterns already linkhtml?.docs/api-reference.mdand the Working With Files wiki page now say why HTML is in and scripts are still out.Why this stores nothing Codeman would serve or run. This revisits the call on #553, where html, htm and svg were named as types to keep out of uploads; no code change prompted it. The two protections that keep an uploaded page inert predate the document list (the sandboxed
html-viewand its hidden-directory rule shipped in 1.41.1, #547), and both are now pinned for uploads by tests:file-rawhas nohtmlentry in its MIME table, so an uploaded page goes out asapplication/octet-streamwithnosniff, which a browser downloads rather than renders. New test intest/routes/file-routes.test.ts, for.htmland.htmunder.codeman-uploads/.html-viewrefuses a page in a hidden directory. The existing test now also names.codeman-uploads(test/routes/html-view-routes.test.ts).An
.htmlsent with an image MIME type still takes the image path and fails its magic-byte check, as before.Validation:
spec.html(text/html) andreport.HTM(no usable MIME); the refusal test keeps.shand.pyand adds.js; the classifier test expectsdocumentfor both extensions; the pickeraccept=fixtures list them.upload-document-list-parity,session-routes,file-routes,html-view-routes,mobile-prompt-composerandtoolbar-attach: 330 of 333 pass locally. The 3 that fail are intoolbar-attach.test.tsand fail the same way on unmodifiedmasterin my environment (SecurityError: localStorage is not available for opaque origins, from a different jsdom version than the repo's). One of them is the drop test I edited, so CI is its first real run.npm testortsclocally: this checkout used existing packages rather than an install. The changed TypeScript passes Prettier with the repo's config, and the two public JS files passnode --check. The PR's CI runs the full suite, typecheck, lint and the boot smoke test.🤖 Generated with Claude Code