From 0cb2fad5b7863711bb97d1ac8c8223a4ba581dbd Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 6 Apr 2022 02:22:47 +0000 Subject: feat: assume index.gmi of path if trailing slash --- maple/maple.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maple/maple.cc b/maple/maple.cc index 2fce54d..e6daeda 100644 --- a/maple/maple.cc +++ b/maple/maple.cc @@ -208,8 +208,8 @@ auto main() -> int { response << "20 text/gemini\r\n" << buffer.str(); } else { - if (path.empty() || path == "/") { - std::ifstream file(".maple/gmi/index.gmi"); + if (path.empty() || path.at(path.length() - 1) == '/') { + std::ifstream file(".maple/gmi" + path + "index.gmi"); std::stringstream buffer; buffer << file.rdbuf(); -- cgit v1.2.3