From 676b098305aa4d92c1d527785d5f27e0602c9051 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 7 Aug 2015 13:22:35 +0200 Subject: [PATCH] Handle null uri.pathname bug Sometimes modules do not require a full path, and can use shorter version, e.g. overzoom://?source=blah which results in the null pathname, which fails in the unescape. --- lib/tilelive.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tilelive.js b/lib/tilelive.js index 09b848b..00d58da 100644 --- a/lib/tilelive.js +++ b/lib/tilelive.js @@ -76,7 +76,9 @@ tilelive.load = function(uri, callback) { if (typeof uri === 'string') { uri = url.parse(uri, true); - uri.pathname = qs.unescape(uri.pathname); + if (uri.pathname) { + uri.pathname = qs.unescape(uri.pathname); + } } // Handle uris in the format /path/to/dir?id=bar