Commit de02f15
committed
Recognise .acl and .meta as RDF resources for conneg (JavaScriptSolidServer#294)
getContentType() in src/utils/url.js is extension-based, but
path.extname() returns '' for leading-dot names like '.acl' /
'.meta' (node treats them as dotfiles, not extensions). Both
fell through to application/octet-stream, which isRdfContentType()
rejects, so handleGet's conneg branch never ran for them.
Effect: Turtle-native clients (umai, Soukai-based apps, older
Solid tooling) fetching <container>/.meta got JSON-LD back and
errored with 'Malformed Turtle document — Expected entity but
got { on line 2'. Hit today against ewingson's test.solidweb.app
pod.
Fix: one basename check in getContentType mapping '.acl' / '.meta'
to application/ld+json — the format JSS already writes them in
(via serializeAcl(), createPodStructure(), etc.). Conneg then
handles translation for Turtle clients through handleGet's
existing JSON-LD-to-Turtle path, and handlePut already converts
incoming Turtle to JSON-LD before storing when --conneg is on.
Zero migration: existing pods on disk stay as-is and become
Turtle-servable immediately.
Tests:
- test/url.test.js: new 'getContentType' describe block — 6 cases
(extension mapping, dotfile mapping, the 'acl-in-filename isn't
an ACL file' guard).
- test/conneg.test.js: new 'Solid convention dotfiles (JavaScriptSolidServer#294)'
block — 3 integration cases against a running server (GET .meta
default → ld+json, GET .meta with Accept: turtle → turtle, PUT
turtle .meta → round-trips to JSON-LD).
Full suite: 407/407 pass (was 398 + 9 new).
The sibling tightening — reject non-JSON-LD PUTs with 415 when
--conneg is off — is tracked separately as JavaScriptSolidServer#295 to avoid conflating
a visible interop break with a design-ier purity fix.
Fixes JavaScriptSolidServer#2941 parent c9c206b commit de02f15
3 files changed
Lines changed: 112 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
242 | 252 | | |
243 | 253 | | |
244 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
197 | 264 | | |
198 | 265 | | |
199 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
0 commit comments