fixed getting list of posts not working behind nginx reverse proxy

This commit is contained in:
Snorre 2025-03-25 11:53:17 +01:00
parent 5c556a0803
commit 6de27d602a

View file

@ -192,7 +192,7 @@ fn handle_connection(mut stream: TcpStream) {
return a.cmp(&b);
});
entries
let data = entries
.into_iter()
.filter_map(|x| {
if let Some(n) = x.file_name().to_str() {
@ -206,7 +206,8 @@ fn handle_connection(mut stream: TcpStream) {
}
})
.reduce(|a, b| format!("{}\n{}", b, a))
.unwrap()
.unwrap();
format!("HTTP/1.1 200 OK\r\nContent-Type: text/text\r\nContent-Length: {}\r\n\r\n{}", data.len(), data)
}
Err(e) => {
eprintln!("\x1b[0;31mError when fetching list of posts: {e:?}\x1b[0m");