From c0863f49bbbf6f28db6b2ee25c970ea9347c5394 Mon Sep 17 00:00:00 2001 From: Antony Date: Fri, 5 Jan 2018 17:59:19 +0300 Subject: [PATCH] Windows local file path resolve fix --- src/url.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/url.cpp b/src/url.cpp index 1f54327..5ed6207 100644 --- a/src/url.cpp +++ b/src/url.cpp @@ -199,8 +199,17 @@ namespace Url } } + // Windows local file path + if (static_cast(url.length() - position) >= 4 + && url[position] == '/' + && url[position + 1] == '/' + && url[position + 2] == '/' + && url[position + 4] == ':') + { + position += 3; + } // Search for the netloc - if ((url.length() - position) >= 1 + else if ((url.length() - position) >= 1 && url[position] == '/' && url[position + 1] == '/') { @@ -443,7 +452,8 @@ namespace Url } else { - if (!host_.empty() && path_[0] != '/') + if ((!host_.empty() && path_[0] != '/') || + (host_.empty() && path_[0] != '/' && path_[2] == ':')) { result.append(1, '/'); }