From 6d54bd0cc66cbf59b303caf2b666aed603f8bf03 Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 1 Nov 2017 22:59:34 +0100 Subject: [PATCH] Fixed the special character problem with a more generic solution --- lib/server/v2/commands/Propfind.js | 2 +- src/server/v2/commands/Propfind.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/server/v2/commands/Propfind.js b/lib/server/v2/commands/Propfind.js index 0152f849..b1ae8a4c 100644 --- a/lib/server/v2/commands/Propfind.js +++ b/lib/server/v2/commands/Propfind.js @@ -61,7 +61,7 @@ function parseRequestBody(ctx, data) { } } function encode(url) { - return url.replace(/ /img, '%20'); + return encodeURI(url); } function propstatStatus(status) { return 'HTTP/1.1 ' + status + ' ' + http.STATUS_CODES[status]; diff --git a/src/server/v2/commands/Propfind.ts b/src/server/v2/commands/Propfind.ts index b07b2633..6f51e660 100644 --- a/src/server/v2/commands/Propfind.ts +++ b/src/server/v2/commands/Propfind.ts @@ -90,7 +90,7 @@ function parseRequestBody(ctx : HTTPRequestContext, data : Buffer) : PropertyRul function encode(url : string) { - return url.replace(/ /img, '%20'); + return encodeURI(url); } function propstatStatus(status : number)