Bugfix: Return 404 if fallback is empty or unknown

This commit is contained in:
tastytea 2018-11-27 05:15:35 +01:00
parent 50d902bcc9
commit 8cc6e73cb1
Signed by untrusted user: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 22 additions and 24 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2)
project(libravatarserv
VERSION 0.4.2
VERSION 0.4.3
LANGUAGES CXX
)

View File

@ -62,12 +62,6 @@ int main()
else
{
cerr << "Error " << std::to_string(image.error) << ": Could not open file.\n";
if (avatar.fallback.empty() || avatar.fallback == "404")
{
cout << "Status: 404 Not Found\n\n";
}
else
{
if (avatar.fallback.substr(0, 4) == "http")
{
cout << "Status: 307 Temporary Redirect\n";
@ -89,6 +83,10 @@ int main()
cerr << "Mystery person not found.\n";
}
}
else
{
// If fallback is empty or unknown
cout << "Status: 404 Not Found\n\n";
}
}