Public: anyone can read this; the crew can change it.

Three more file kinds open readable: .ini/.properties, .rtf and .xml #14077

Closed opened this
Closed without merging

.ini, .properties, .rtf and .xml files now open as drawn views instead of raw source, and the branch is pushed. Checks: tsc, gate --fix and design-lint are clean. 40 test files that touch the file-kind registry pass (456 pass, 1 skip, 0 fail), including the new test/render-ini-rtf-xml.test.ts.

Notes

stopped closed without shipping deploy ca7db09

opened this

.ini, .properties, .rtf and .xml files now open as drawn views instead of raw source, and the branch is pushed.

Checks:

  • tsc, gate --fix and design-lint are clean.
  • 40 test files that touch the file-kind registry pass (456 pass, 1 skip, 0 fail), including the new test/render-ini-rtf-xml.test.ts.
  • I did not run the whole suite. scripts/fast.ts found the diff too broad to name tests.
  • I did not start the app and look at a page, so none of the three views has been viewed in a browser.

What each shows:

  • .ini / .properties: one table per [section] with a row per key. A value is shown as ••• when its key ends in key, secret, token or password. Capped at 500 settings, and over 1 MB it opens as text. .conf stays a config file.
  • .rtf: the text as paragraphs, with formatting dropped and font tables, pictures and other embedded parts skipped. Capped at 100,000 characters, and over 5 MB it opens as text. A .rtf that doesn't start with {\rtf is treated as plain text.
  • .xml: the element tree with attributes and leaf text. Entities are never expanded and the doctype is skipped. Capped at 1,000 elements and 24 levels, and over 5 MB it opens as text. JUnit, OPML and feed .xml files keep their own views.

What changed in the code:

  • Renderers: src/web/render/ini.ts, rtf.ts and xml.ts are new, registered in renderers.ts.
  • Kinds: kinds.ts has three new kinds, and .ini moved from config to the new ini kind.
  • Media types: the media route still serves all three as application/octet-stream, so the allowlist is unchanged.
  • Docs: I added docs/features/file-ini-rtf-xml.md, a link to it in README.md, and regenerated the file-kinds.md guide.
  • Test fix: I changed the .ini row in test/render-kinds.test.ts from config to ini, since the test was wrong once .ini moved.

Tests: there are 15 tests in the new file. Each renderer has a hostile sample that must come out escaped, and the registry test covers a file whose bytes disagree with its name.

Left out: the terminal (src/tui) still shows these three as source. There are no new dependencies.

To try: commit an .ini, .properties, .rtf or .xml file to a repository and open it. ?view=source still shows the raw text.

The pre-push hook refused the first push because no commit message carried a Try: line. The second commit, an empty one, adds it.

🤖 Generated with Claude Code

Closes #14044

2 earlier comments
commented

.ini, .properties, .rtf and .xml files now open as drawn views instead of raw source, and the branch is pushed.

Checks:

  • tsc, gate --fix and design-lint are clean.
  • 40 test files that touch the file-kind registry pass (456 pass, 1 skip, 0 fail), including the new test/render-ini-rtf-xml.test.ts.
  • I did not run the whole suite. scripts/fast.ts found the diff too broad to name tests.
  • I did not start the app and look at a page, so none of the three views has been viewed in a browser.

What each shows:

  • .ini / .properties: one table per [section] with a row per key. A value is shown as ••• when its key ends in key, secret, token or password. Capped at 500 settings, and over 1 MB it opens as text. .conf stays a config file.
  • .rtf: the text as paragraphs, with formatting dropped and font tables, pictures and other embedded parts skipped. Capped at 100,000 characters, and over 5 MB it opens as text. A .rtf that doesn't start with {\rtf is treated as plain text.
  • .xml: the element tree with attributes and leaf text. Entities are never expanded and the doctype is skipped. Capped at 1,000 elements and 24 levels, and over 5 MB it opens as text. JUnit, OPML and feed .xml files keep their own views.

What changed in the code:

  • Renderers: src/web/render/ini.ts, rtf.ts and xml.ts are new, registered in renderers.ts.
  • Kinds: kinds.ts has three new kinds, and .ini moved from config to the new ini kind.
  • Media types: the media route still serves all three as application/octet-stream, so the allowlist is unchanged.
  • Docs: I added docs/features/file-ini-rtf-xml.md, a link to it in README.md, and regenerated the file-kinds.md guide.
  • Test fix: I changed the .ini row in test/render-kinds.test.ts from config to ini, since the test was wrong once .ini moved.

Tests: there are 15 tests in the new file. Each renderer has a hostile sample that must come out escaped, and the registry test covers a file whose bytes disagree with its name.

Left out: the terminal (src/tui) still shows these three as source. There are no new dependencies.

To try: commit an .ini, .properties, .rtf or .xml file to a repository and open it. ?view=source still shows the raw text.

The pre-push hook refused the first push because no commit message carried a Try: line. The second commit, an empty one, adds it.

🤖 Generated with Claude Code

commented

Closed by the crew: superseded, its change is already on main in 83f83cd6.

commented

Left #14044 open: 4 unticked items remain (each kind has a renderer in the pattern of src/web/render/mbox.ts (plain data in, escaped html out); kinds.ts media types stay on the allowlist; a file whose bytes disagree with its name stays octet-stream; a sample of each in test/render-ini-rtf-xml.test.ts, with a hostile sample that must be escaped; …).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs