Skip to content

Commit

Permalink
Windows local file path resolve fix
Browse files Browse the repository at this point in the history
.


.
  • Loading branch information
akustovbanuba committed Jan 8, 2018
1 parent e884eac commit 6085caa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,15 @@ namespace Url
}
}

// Windows file path
if ((strnicmp(scheme_.c_str(), "file", 4) == 0) &&
(static_cast<int>(url.length() - position) >= 2
&& url[position] == '/'
&& url[position + 2] == ':'))
{
position += 1;
}

if (position != std::string::npos)
{
path_.assign(url, position, std::string::npos);
Expand Down Expand Up @@ -443,7 +452,8 @@ namespace Url
}
else
{
if (!host_.empty() && path_[0] != '/')
if ((!host_.empty() && path_[0] != '/') ||
(host_.empty() && path_[0] != '/' && path_[1] == ':'))
{
result.append(1, '/');
}
Expand Down

0 comments on commit 6085caa

Please sign in to comment.