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:
parent
30d838aec3
commit
dbbd72fe75
1 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue