Skip to content

Commit

Permalink
Added encoding for the url in the PROPPATCH and PROPFIND responses [v1]
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienCastex committed Jun 30, 2017
1 parent 77c44cd commit 30d5bcc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/server/commands/Propfind.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function method(arg, callback) {
activelock.ele('D:owner').add(lock.owner);
activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()));
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'));
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(encodeURI(arg.fullUri(path_1)));
}
}
nbOut(null);
Expand All @@ -259,7 +259,7 @@ function method(arg, callback) {
nbOut(e);
return;
}
var p = arg.fullUri(path).replace(' ', '%20');
var p = encodeURI(arg.fullUri(path));
var href = p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p;
response.ele('D:href', undefined, true).add(href);
response.ele('D:location').ele('D:href', undefined, true).add(p);
Expand Down Expand Up @@ -294,7 +294,7 @@ function method(arg, callback) {
methodDisplayName = resource.displayName;
methodDisplayName.bind(resource)(function (e, name) { return process.nextTick(function () {
if (!e)
tags.displayname.el.add(name ? name : '');
tags.displayname.el.add(name ? encodeURI(name) : '');
nbOut(e);
}); });
});
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 @@ -17,7 +17,7 @@ function method(arg, callback) {
'xmlns:D': 'DAV:'
});
var response = multistatus.ele('D:response');
response.ele('D:href', undefined, true).add(arg.fullUri());
response.ele('D:href', undefined, true).add(encodeURI(arg.fullUri()));
try {
var xml = XML_1.XML.parse(arg.data);
var root_1 = xml.find('DAV:propertyupdate');
Expand Down
6 changes: 3 additions & 3 deletions src/server/commands/Propfind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export function method(arg : MethodCallArgs, callback)
activelock.ele('D:owner').add(lock.owner)
activelock.ele('D:timeout').add('Second-' + (lock.expirationDate - Date.now()))
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'))
activelock.ele('D:lockroot').ele('D:href', undefined, true).add(encodeURI(arg.fullUri(path)))
}
}

Expand All @@ -344,7 +344,7 @@ export function method(arg : MethodCallArgs, callback)
return;
}

const p = arg.fullUri(path).replace(' ', '%20');
const p = encodeURI(arg.fullUri(path));
const href = p.lastIndexOf('/') !== p.length - 1 && type.isDirectory ? p + '/' : p;
response.ele('D:href', undefined, true).add(href);
response.ele('D:location').ele('D:href', undefined, true).add(p);
Expand Down Expand Up @@ -390,7 +390,7 @@ export function method(arg : MethodCallArgs, callback)

methodDisplayName.bind(resource)((e, name) => process.nextTick(() => {
if(!e)
tags.displayname.el.add(name ? name : '');
tags.displayname.el.add(name ? encodeURI(name) : '');
nbOut(e);
}))
})
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 @@ -21,7 +21,7 @@ export function method(arg : MethodCallArgs, callback)
'xmlns:D': 'DAV:'
});
const response = multistatus.ele('D:response');
response.ele('D:href', undefined, true).add(arg.fullUri());
response.ele('D:href', undefined, true).add(encodeURI(arg.fullUri()));

try
{
Expand Down

0 comments on commit 30d5bcc

Please sign in to comment.