Skip to content

Commit 5c40c8f

Browse files
committed
reject .acl with bad contentType
1 parent aff47f8 commit 5c40c8f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/ldp.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ class LDP {
143143
if (slug.match(/\/|\||:/)) {
144144
throw error(400, 'The name of new file POSTed may not contain : | or /')
145145
}
146+
// not to break pod ACL must have text/turtle contentType
147+
if (slug.endsWith(this.suffixAcl) || extension === this.suffixAcl) {
148+
if (contentType !== this.aclContentType) {
149+
throw error(415, 'POST contentType for ACL must be text/turtle')
150+
}
151+
}
146152
}
147153
// Containers should not receive an extension
148154
if (container) {
@@ -214,6 +220,11 @@ class LDP {
214220
'PUT request require a valid content type via the Content-Type header')
215221
}
216222

223+
// not to break pod : url ACL must have text/turtle contentType
224+
if ((url.url || url).endsWith(this.suffixAcl) && contentType !== this.aclContentType) {
225+
throw error(415, 'PUT contentType for ACL must be text-turtle')
226+
}
227+
217228
// First check if we are above quota
218229
let isOverQuota
219230
try {

0 commit comments

Comments
 (0)