Skip to content

Commit

Permalink
Now write 'DAV:href' at the head of the parent's children, fixing iss…
Browse files Browse the repository at this point in the history
…ues with 'cadaver', 'davfs2', etc...
  • Loading branch information
AdrienCastex committed Jun 13, 2017
1 parent 310b860 commit 9d9d512
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/server/commands/Lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function createResponse(arg, lock) {
var activelock = prop.ele('D:lockdiscovery').ele('D:activelock');
activelock.ele('D:locktype').ele(lock.lockKind.type.value);
activelock.ele('D:lockscope').ele(lock.lockKind.scope.value);
activelock.ele('D:locktoken').ele('D:href').add(lock.uuid);
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid);
activelock.ele('D:lockroot').add(arg.fullUri());
activelock.ele('D:depth').add('infinity');
activelock.ele('D:owner').add(lock.owner);
Expand Down
8 changes: 4 additions & 4 deletions lib/server/commands/Propfind.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ function default_1(arg, callback) {
if (lock.owner)
activelock.ele('D:owner').add(lock.owner);
activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()));
activelock.ele('D:locktoken').ele('D:href').add(lock.uuid);
activelock.ele('D:lockroot').ele('D:href').add(arg.fullUri(path_1).replace(' ', '%20'));
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid);
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(arg.fullUri(path_1).replace(' ', '%20'));
}
}
nbOut(null);
Expand All @@ -245,8 +245,8 @@ function default_1(arg, callback) {
return;
}
var p = arg.fullUri(path).replace(' ', '%20');
response.ele('D:href').add(p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p);
response.ele('D:location').ele('D:href').add(p);
response.ele('D:href', undefined, true).add(p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p);
response.ele('D:location').ele('D:href', undefined, true).add(p);
if (tags.resourcetype.value && type.isDirectory)
tags.resourcetype.el.ele('D:collection');
if (type.isFile) {
Expand Down
2 changes: 1 addition & 1 deletion lib/server/commands/Proppatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function default_1(arg, callback) {
'xmlns:D': 'DAV:'
});
var response = multistatus.ele('D:response');
response.ele('D:href').add(arg.fullUri());
response.ele('D:href', undefined, true).add(arg.fullUri());
try {
var xml = XML_1.XML.parse(arg.data);
var root_1 = xml.find('DAV:propertyupdate');
Expand Down
2 changes: 1 addition & 1 deletion src/server/commands/Lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function createResponse(arg : MethodCallArgs, lock : Lock)

activelock.ele('D:locktype').ele(lock.lockKind.type.value);
activelock.ele('D:lockscope').ele(lock.lockKind.scope.value);
activelock.ele('D:locktoken').ele('D:href').add(lock.uuid);
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid);
activelock.ele('D:lockroot').add(arg.fullUri());
activelock.ele('D:depth').add('infinity');
activelock.ele('D:owner').add(lock.owner);
Expand Down
8 changes: 4 additions & 4 deletions src/server/commands/Propfind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ export default function(arg : MethodCallArgs, callback)
if(lock.owner)
activelock.ele('D:owner').add(lock.owner)
activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()))
activelock.ele('D:locktoken').ele('D:href').add(lock.uuid)
activelock.ele('D:lockroot').ele('D:href').add(arg.fullUri(path).replace(' ', '%20'))
activelock.ele('D:locktoken').ele('D:href', undefined, true).add(lock.uuid)
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(arg.fullUri(path).replace(' ', '%20'))
}
}

Expand All @@ -327,8 +327,8 @@ export default function(arg : MethodCallArgs, callback)
}

const p = arg.fullUri(path).replace(' ', '%20');
response.ele('D:href').add(p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p);
response.ele('D:location').ele('D:href').add(p);
response.ele('D:href', undefined, true).add(p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p);
response.ele('D:location').ele('D:href', undefined, true).add(p);

if(tags.resourcetype.value && type.isDirectory)
tags.resourcetype.el.ele('D:collection')
Expand Down
2 changes: 1 addition & 1 deletion src/server/commands/Proppatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function(arg : MethodCallArgs, callback)
'xmlns:D': 'DAV:'
});
const response = multistatus.ele('D:response');
response.ele('D:href').add(arg.fullUri());
response.ele('D:href', undefined, true).add(arg.fullUri());

try
{
Expand Down

0 comments on commit 9d9d512

Please sign in to comment.