loolwsd: invert this condition, so it's possible to add other cases

This commit is contained in:
Miklos Vajna 2015-10-16 15:47:39 +02:00
parent 700b7d08b7
commit 63bf9a1329

View file

@ -201,12 +201,8 @@ public:
{
// The user might request a file to download
StringTokenizer tokens(request.getURI(), "/");
if (tokens.count() != 4)
if (tokens.count() == 4)
{
response.setStatus(HTTPResponse::HTTP_BAD_REQUEST);
response.setContentLength(0);
response.send();
}
std::string dirPath = LOOLWSD::childRoot + "/" + tokens[1] + LOOLSession::jailDocumentURL + "/" + tokens[2];
std::string filePath = dirPath + "/" + tokens[3];
std::cout << Util::logPrefix() << "HTTP request for: " << filePath << std::endl;
@ -224,6 +220,13 @@ public:
response.setContentLength(0);
response.send();
}
}
else
{
response.setStatus(HTTPResponse::HTTP_BAD_REQUEST);
response.setContentLength(0);
response.send();
}
return;
}