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,11 +211,14 @@ std::string HTTP::URL::getFilePath() const{
/// Returns whether the URL is probably pointing to a local file
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 (host.size() || protocol.size() || port.size()){
return false;
}
return true;
if (!host.size() && !protocol.size() && !port.size()){return true;}
//Anything else is probably not local
return false;
}
/// Returns the URL in string format without auth and frag