diff --git a/src/url.cpp b/src/url.cpp index 1f54327..abae1d9 100644 --- a/src/url.cpp +++ b/src/url.cpp @@ -266,6 +266,15 @@ namespace Url } } + // Windows file path + if ((strncmp(scheme_.c_str(), "file", 4) == 0) && + (static_cast(url.length() - position) >= 2 + && url[position] == '/' + && url[position + 2] == ':')) + { + position += 1; + } + if (position != std::string::npos) { path_.assign(url, position, std::string::npos); @@ -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, '/'); }