Skip to content

fix(import): infer the content type from the file extension - #12

Merged
EthanThatOneKid merged 1 commit into
mainfrom
import-infer-content-type
Oct 10, 2026
Merged

EthanThatOneKid merged 1 commit into
mainfrom
import-infer-content-type

Conversation

@EthanThatOneKid

Copy link
Copy Markdown
Contributor

Bug. --type defaulted to text/plain, so wazoo worlds import <worldId> --file ./data.ttl (exactly as docs.wazoo.dev shows it) sent Turtle as text chunks. Each line was stored as a chunk instead of being parsed into triples. There was no error, just wrong data.

Fix. With no --type:

  • .ttl maps to text/turtle
  • .trig maps to application/trig
  • .nt maps to application/n-triples
  • .nq maps to application/n-quads
  • .n3 maps to text/n3
  • .json maps to application/json (quad rows)
  • anything else, and inline --data, stays text/plain

An explicit --type still wins. The server parses these types as of worlds-api#115, which is live on QA.

Verified: format:check, lint, typecheck and build pass, as does the legacy-identity guard. importContentType returns the expected type for all 7 cases checked against the built output, and --help shows the new default.

🤖 Generated with Claude Code

--type defaulted to text/plain, so `wazoo worlds import <id> --file data.ttl`
(as the docs show) stored each Turtle line as a text chunk instead of
importing triples. With no --type, .ttl/.trig/.nt/.nq/.n3 map to their RDF
types and .json to quad rows; anything else stays text/plain, and an
explicit --type still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EthanThatOneKid
EthanThatOneKid merged commit 268e180 into main Oct 10, 2026
1 check passed
@EthanThatOneKid
EthanThatOneKid deleted the import-infer-content-type branch October 10, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant