From d65e29c67dcba2634528ccdfeb4ff6615b1b9cb8 Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Wed, 2 Mar 2016 15:17:14 +0200 Subject: [PATCH] Ensure no beginning slash in synced file paths --- lib/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 6da614c..affe7c0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -137,7 +137,9 @@ export default class Now extends EventEmitter { function toRelative (path, base) { const fullBase = /\/$/.test(base) ? base + '/' : base; - return path.substr(fullBase.length); + const relative path.substr(fullBase.length); + if (relative.startsWith('/')) return relative.substr(1); + return relative; } function responseError (res) {