Skip to content

Commit c0863f4

Browse files
committed
Windows local file path resolve fix
1 parent e884eac commit c0863f4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/url.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,17 @@ namespace Url
199199
}
200200
}
201201

202+
// Windows local file path
203+
if (static_cast<int>(url.length() - position) >= 4
204+
&& url[position] == '/'
205+
&& url[position + 1] == '/'
206+
&& url[position + 2] == '/'
207+
&& url[position + 4] == ':')
208+
{
209+
position += 3;
210+
}
202211
// Search for the netloc
203-
if ((url.length() - position) >= 1
212+
else if ((url.length() - position) >= 1
204213
&& url[position] == '/'
205214
&& url[position + 1] == '/')
206215
{
@@ -443,7 +452,8 @@ namespace Url
443452
}
444453
else
445454
{
446-
if (!host_.empty() && path_[0] != '/')
455+
if ((!host_.empty() && path_[0] != '/') ||
456+
(host_.empty() && path_[0] != '/' && path_[2] == ':'))
447457
{
448458
result.append(1, '/');
449459
}

0 commit comments

Comments
 (0)