Skip to content

Commit 6822a82

Browse files
committed
catch err
1 parent 9684cca commit 6822a82

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/handlers/allow.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ function allow (mode) {
7272
}
7373
}
7474

75-
// check user is owner. Check isOwner from /.meta
76-
if (resourceUrl.endsWith('.acl') && await ldp.isOwner(userId, req.hostname)) return next()
77-
75+
// check if user is owner. Check isOwner from /.meta
76+
try {
77+
if (resourceUrl.endsWith('.acl') && (await ldp.isOwner(userId, req.hostname))) return next()
78+
} catch (err) {}
7879
const error = req.authError || await req.acl.getError(userId, mode)
7980
debug(`${mode} access denied to ${userId || '(none)'}: ${error.status} - ${error.message}`)
8081
next(error)

test/integration/ldp-test.js

+7
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ describe('LDP', function () {
9797
assert.equal(isOwner, true)
9898
})
9999
})
100+
it('should return acl:owner false', () => {
101+
const owner = 'https://tim.localhost:7777/profile/card'
102+
return ldp.isOwner(owner, '/resources/')
103+
.then(isOwner => {
104+
assert.equal(isOwner, false)
105+
})
106+
})
100107
})
101108
describe('getGraph', () => {
102109
it('should read and parse an existing file', () => {

0 commit comments

Comments
 (0)