diff --git a/Cargo.lock b/Cargo.lock index 162f2f4..2acb580 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,7 +218,7 @@ dependencies = [ [[package]] name = "starfig" -version = "0.1.0" +version = "0.1.1" dependencies = [ "native-tls", "packeteer", diff --git a/Cargo.toml b/Cargo.toml index 3135c66..e88ef6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "starfig" -version = "0.1.0" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index f068af0..c96ad47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ use std::io::{BufRead, BufReader, Write}; use std::net::{TcpListener, TcpStream}; use std::string::{String}; use std::io::{Read}; +use std::path::Path; use std::sync::Arc; use std::fs::File; use std::fs; @@ -22,6 +23,9 @@ fn load_page(segments: Vec) -> String { for v in segments { m = format!("{}/{}", m, v); } + if Path::new(&m).is_dir() == true { + m = format!("{}/index.gmi", m); + } let page = fs::read_to_string(m); match page { Ok(i) => i.to_string(),