Skip to content

Commit 18a7a04

Browse files
committed
Modified simple validation to only affect ACL files
1 parent ea9b40c commit 18a7a04

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

lib/handlers/put.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ async function handler (req, res, next) {
3333
// }
3434
// return putStream(req, res, next)
3535
// }
36+
//
37+
//}
38+
//
39+
//function isAclFile (req) {
40+
// const originalUrlParts = req.originalUrl.split('.')
41+
// return originalUrlParts[originalUrlParts.length - 1] === 'acl'
42+
//}
3643
//
3744
// function putText (req, res, next) {
3845
// const ldp = req.app.locals.ldp

test/integration/validate-tts.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,36 @@ const invalidTurtleBody = fs.readFileSync(path.join(__dirname, '../resources/inv
1616

1717
describe('HTTP requests with invalid Turtle syntax', () => {
1818
describe('PUT API', () => {
19-
it('should return 400', (done) => {
20-
server.put('/should-not-be-created.ttl')
19+
it('is allowed with invalid TTL files', (done) => {
20+
server.put('/invalid1.ttl')
21+
.send(invalidTurtleBody)
22+
.set('content-type', 'text/turtle')
23+
.expect(201, done)
24+
})
25+
26+
it('is not allowed with invalid ACL files', (done) => {
27+
server.put('/invalid1.ttl.acl')
2128
.send(invalidTurtleBody)
2229
.set('content-type', 'text/turtle')
2330
.expect(400, done)
2431
})
2532
})
2633

27-
describe.skip('PATCH API', () => {
28-
it('should return 400', (done) => { // TODO: This returns 415 right now
34+
describe('PATCH API', () => {
35+
it('does not support patching of TTL files', (done) => {
2936
server.patch('/patch-1-initial.ttl')
3037
.send(invalidTurtleBody)
3138
.set('content-type', 'text/turtle')
32-
.expect(400, done)
39+
.expect(415, done)
3340
})
3441
})
3542

36-
describe.skip('POST API (multipart)', () => { // TODO: Is this something we should validate?
37-
it('should create as many files as the ones passed in multipart', (done) => {
43+
describe('POST API (multipart)', () => {
44+
it('does not validate files that are posted', (done) => {
3845
server.post('/')
39-
.attach('timbl', path.join(__dirname, '../resources/invalid1.ttl'))
40-
.attach('nicola', path.join(__dirname, '../resources/invalid2.ttl'))
41-
.expect(400, done)
46+
.attach('invalid1', path.join(__dirname, '../resources/invalid1.ttl'))
47+
.attach('invalid2', path.join(__dirname, '../resources/invalid2.ttl'))
48+
.expect(200, done)
4249
})
4350
})
4451
})

0 commit comments

Comments
 (0)