0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 05:08:59 +02:00

ircd: Handle a resource not found properly.

This commit is contained in:
Jason Volk 2017-08-23 15:47:54 -06:00
parent 30d838aec3
commit dbbd72fe75

View file

@ -40,9 +40,16 @@ ircd::resource::find(string_view path)
{
path = lstrip(path, '/');
path = strip(path, '/');
auto it(resources.lower_bound(path));
if(it == end(resources))
if(it == end(resources)) try
{
return *resources.at(string_view{});
}
catch(const std::out_of_range &e)
{
throw http::error(http::code::NOT_FOUND);
}
// Exact file or directory match
if(path == it->first)