correctly redirect directories

cf. <https://lists.orbitalfox.eu/archives/gemini/2021/004827.html>
This commit is contained in:
Johann150 2021-01-16 13:08:21 +01:00 committed by Matt Brubeck
parent 681ba770a1
commit 972ecf8c13

View file

@ -204,7 +204,9 @@ async fn send_response(url: Url, stream: &mut TlsStream<TcpStream>) -> Result {
}
} else {
// if client is not redirected, links may not work as expected without trailing slash
return send_header(stream, 31, &[url.as_str(), "/"]).await;
let mut url = url;
url.set_path(&format!("{}/", url.path()));
return send_header(stream, 31, &[url.as_str()]).await;
}
}
}