aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-06 02:22:47 +0000
committerFuwn <[email protected]>2022-04-06 02:22:47 +0000
commit0cb2fad5b7863711bb97d1ac8c8223a4ba581dbd (patch)
treec212d4abc26b0d8f709bb5a814b34b3d801cd576
parentchore(examples): use gem.rest as example directory (diff)
downloadmaple-0cb2fad5b7863711bb97d1ac8c8223a4ba581dbd.tar.xz
maple-0cb2fad5b7863711bb97d1ac8c8223a4ba581dbd.zip
feat: assume index.gmi of path if trailing slash
-rw-r--r--maple/maple.cc4
1 files 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();