Skip to content

Commit e142d78

Browse files
committed
Merge remote-tracking branch 'origin/main' into check-write-on-container-for-delete
2 parents 8c925c0 + 303b784 commit e142d78

File tree

6 files changed

+71
-49
lines changed

6 files changed

+71
-49
lines changed

lib/handlers/patch/n3-patch-parser.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,26 @@ async function parsePatchDocument (targetURI, patchURI, patchText) {
2020

2121
// Query the N3 document for insertions and deletions
2222
let firstResult
23-
try {
23+
try { // solid/protocol v0.9.0
2424
firstResult = await queryForFirstResult(patchGraph, `${PREFIXES}
2525
SELECT ?insert ?delete ?where WHERE {
26-
?patch solid:patches <${targetURI}>.
26+
?patch a solid:InsertDeletePatch.
2727
OPTIONAL { ?patch solid:inserts ?insert. }
2828
OPTIONAL { ?patch solid:deletes ?delete. }
2929
OPTIONAL { ?patch solid:where ?where. }
3030
}`)
3131
} catch (err) {
32-
throw error(400, `No patch for ${targetURI} found.`, err)
32+
try { // deprecated, kept for compatibility
33+
firstResult = await queryForFirstResult(patchGraph, `${PREFIXES}
34+
SELECT ?insert ?delete ?where WHERE {
35+
?patch solid:patches <${targetURI}>.
36+
OPTIONAL { ?patch solid:inserts ?insert. }
37+
OPTIONAL { ?patch solid:deletes ?delete. }
38+
OPTIONAL { ?patch solid:where ?where. }
39+
}`)
40+
} catch (err) {
41+
throw error(400, 'No n3-patch found.', err)
42+
}
3343
}
3444

3545
// Return the insertions and deletions as an rdflib patch document

lib/header.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ async function linksHandler (req, res, next) {
6666
return next(error(404, 'Trying to access metadata file as regular file'))
6767
}
6868
const fileMetadata = new metadata.Metadata()
69-
if (filename.endsWith('/')) {
69+
if (req.path.endsWith('/')) {
70+
// do not add storage header in serverUri
7071
if (req.path === '/') fileMetadata.isStorage = true
7172
fileMetadata.isContainer = true
7273
fileMetadata.isBasicContainer = true

package-lock.json

Lines changed: 20 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"nodemailer": "^6.7.0",
9494
"oidc-op-express": "^0.0.3",
9595
"owasp-password-strength-test": "^1.3.0",
96-
"rdflib": "^2.2.10",
96+
"rdflib": "^2.2.14",
9797
"recursive-readdir": "^2.2.2",
9898
"request": "^2.88.2",
9999
"rimraf": "^3.0.2",

test/integration/http-test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ describe('HTTP APIs', function () {
167167
.end(done)
168168
})
169169

170-
// This test is probably wrong: it is not a container if there is an index page
171-
it.skip('should have set Link as resource on a implicit index page', function (done) {
170+
it('should have set Link as Container/BasicContainer on an implicit index page', function (done) {
172171
server.options('/sampleContainer/')
173172
.expect('Link', /<http:\/\/www.w3.org\/ns\/ldp#BasicContainer>; rel="type"/)
174173
.expect('Link', /<http:\/\/www.w3.org\/ns\/ldp#Container>; rel="type"/)

0 commit comments

Comments
 (0)