Title: Without --conneg, reject non-JSON-LD PUTs with 415 instead of silently storing · Issue #295 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: Without --conneg, reject non-JSON-LD PUTs with 415 instead of silently storing · Issue #295 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: Without --conneg, reject non-JSON-LD PUTs with 415 instead of silently storing · Issue #295 · JavaScriptSolidServer/JavaScriptSolidServer
Description: The inconsistency JSS is "JSON-LD native" by design — `--conneg` is off by default (`src/config.js:29`: `conneg: false`). The stance is: if you want to read/write Turtle, opt in explicitly. But the PUT handler today doesn't enforce that ...
Open Graph Description: The inconsistency JSS is "JSON-LD native" by design — `--conneg` is off by default (`src/config.js:29`: `conneg: false`). The stance is: if you want to read/write Turtle, opt in explicitly. But the...
X Description: The inconsistency JSS is "JSON-LD native" by design — `--conneg` is off by default (`src/config.js:29`: `conneg: false`). The stance is: if you want to read/write Turtle, opt in explicitl...
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/295
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Without --conneg, reject non-JSON-LD PUTs with 415 instead of silently storing","articleBody":"## The inconsistency\n\nJSS is \\\"JSON-LD native\\\" by design — \\`--conneg\\` is **off** by default (\\`src/config.js:29\\`: \\`conneg: false\\`). The stance is: if you want to read/write Turtle, opt in explicitly.\n\nBut the PUT handler today doesn't enforce that stance. Looking at \\`src/handlers/resource.js:638-647\\`:\n\n\\`\\`\\`js\nconst inputType = contentType.split(';')[0].trim().toLowerCase();\nif (connegEnabled && (inputType === RDF_TYPES.TURTLE || inputType === RDF_TYPES.N3)) {\n try {\n const jsonLd = await toJsonLd(content, contentType, resourceUrl, connegEnabled);\n content = Buffer.from(JSON.stringify(jsonLd, null, 2));\n } catch (e) { /* 400 */ }\n}\n// … goes on to storage.write(storagePath, content) unconditionally\n\\`\\`\\`\n\nSo with \\`--conneg\\` **off**:\n- Client PUTs \\`Content-Type: text/turtle\\` body.\n- The if-block is skipped (conneg disabled).\n- \\`content\\` is still the raw Turtle bytes.\n- JSS writes those bytes to disk at, say, \\`foo.jsonld\\` → now the file on disk is Turtle content with a \\`.jsonld\\` URL.\n- Subsequent GET: JSS reads the file, \\`getContentType()\\` sees \\`.jsonld\\` → says \\`application/ld+json\\`. Serves Turtle bytes with a JSON-LD content-type header. Parser on the client errors.\n\nSo \\`--conneg=false\\` + Turtle PUT = silent corruption.\n\n## Proposal\n\nWhen \\`--conneg\\` is off, reject non-JSON-LD PUT bodies on RDF routes with \\`415 Unsupported Media Type\\` and an \\`Accept-Post\\` / \\`Accept-Patch\\` header listing \\`application/ld+json\\`. Makes the server's contract explicit:\n\n> \\\"I am JSON-LD native. Start me with \\`--conneg\\` if you want Turtle / N3 translation.\\\"\n\nRough shape:\n\n\\`\\`\\`js\nconst rdfInputTypes = [RDF_TYPES.JSON_LD, 'application/json'];\nif (!connegEnabled && contentType && !rdfInputTypes.includes(inputType) && looksLikeRdfResource(resourceUrl)) {\n return reply\n .code(415)\n .header('Accept', 'application/ld+json')\n .send({ error: 'Unsupported Media Type',\n message: 'This server is JSON-LD native. Start with --conneg to accept text/turtle or text/n3.' });\n}\n\\`\\`\\`\n\n\\`looksLikeRdfResource()\\` is the small new helper — e.g. extension in \\`{.jsonld, .json, .ttl, .n3, .acl, .meta}\\`, or no extension and path looks like a Solid resource (profile/card, …). Out of scope to get exhaustive; start with the common set.\n\n## Non-goals\n\n- Not changing default mode. \\`conneg: false\\` stays the default.\n- Not changing behaviour when \\`--conneg\\` is on — that path is fine (translation happens).\n- Not touching binary / non-RDF uploads (images, text, etc.). The guard is specifically for RDF-shaped resources.\n\n## Why not fold this into #294\n\n- \\#294 fixes a visible interop break (umai 500s today). This is a latent purity tightening.\n- Conflating them risks \\#294 stalling on 415-design bikeshed. Better: ship \\#294 first (unblocks real users), ship this after.\n- Different reviewers might also weigh in differently — #294 is clearly right, this involves a stance call.\n\n## Scope\n\n~20 lines in \\`handlePut\\` + a helper. Plus one test per rejected case. Small, but touches the PUT path, so the full suite is worth running.\n\nHappy to PR after #294.","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-04-22T11:09:59Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/295"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ed9f8025-322a-bba9-cf6a-b9d57049fbe8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 932E:20B2A8:B3A2CC:EF987B:6B03D07C |
| html-safe-nonce | d42863315347bd98803a036ea2a801f85bc6aced26a035e603f09fe44d281dba |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzJFOjIwQjJBODpCM0EyQ0M6RUY5ODdCOjZCMDNEMDdDIiwidmlzaXRvcl9pZCI6IjM4MTM3NDkxODA0NDc1NzYxODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f4df4bf2f16e65ffcce0a0563fd251bf42f400d71cb44497fb938279786ee501 |
| hovercard-subject-tag | issue:4308550460 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/295/issue_layout |
| twitter:image | https://opengraph.githubassets.com/054354c7e02e1d9b4517183ddf9ff7ede9a33222de09e0ce4600ac4b76732c72/JavaScriptSolidServer/JavaScriptSolidServer/issues/295 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/054354c7e02e1d9b4517183ddf9ff7ede9a33222de09e0ce4600ac4b76732c72/JavaScriptSolidServer/JavaScriptSolidServer/issues/295 |
| og:image:alt | The inconsistency JSS is "JSON-LD native" by design — `--conneg` is off by default (`src/config.js:29`: `conneg: false`). The stance is: if you want to read/write Turtle, opt in explicitly. But the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width