commit 85ea736eb21c42ca1550d2c5b78cd5c704123802
parent 0872e3d1fef562c0631e005d8995e01e4c9c5a04
Author: Matt Brubeck <mbrubeck@limpet.net>
Date: Wed, 20 May 2020 08:28:22 -0700
Don't panic on cannot-be-a-base URLs
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main.rs b/src/main.rs
@@ -106,7 +106,7 @@ async fn parse_request(stream: &mut TlsStream<TcpStream>) -> Result<Url> {
fn get(url: &Url) -> Result<Vec<u8>> {
let mut path = PathBuf::from(&ARGS.content_dir);
- path.extend(url.path_segments().unwrap());
+ path.extend(url.path_segments().ok_or("invalid url")?);
if path.is_dir() {
path.push("index.gemini");
}