Fix detection of local paths in URL library

This commit is contained in:
Thulinma 2022-11-16 01:34:46 +01:00
parent a8139e1b99
commit 7c36de707f

View file

@ -211,12 +211,15 @@ std::string HTTP::URL::getFilePath() const{
/// Returns whether the URL is probably pointing to a local file /// Returns whether the URL is probably pointing to a local file
bool HTTP::URL::isLocalPath() const{ bool HTTP::URL::isLocalPath() const{
//Anything with a "file" protocol is explicitly a local file
if (protocol == "file"){return true;}
// If we have no host, protocol or port we can assume it is a local path // If we have no host, protocol or port we can assume it is a local path
if (host.size() || protocol.size() || port.size()){ if (!host.size() && !protocol.size() && !port.size()){return true;}
//Anything else is probably not local
return false; return false;
} }
return true;
}
/// Returns the URL in string format without auth and frag /// Returns the URL in string format without auth and frag
std::string HTTP::URL::getProxyUrl() const{ std::string HTTP::URL::getProxyUrl() const{