agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

commit 681ba770a11bb9e8a0143b1090dc0bdd0e67fb97
parent af783f6911cd17b91aa03d8a15369761a737aa55
Author: Johann150 <johann.galle@protonmail.com>
Date:   Tue,  5 Jan 2021 19:57:51 +0100

check all path components

Diffstat:
Msrc/main.rs | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -183,9 +183,12 @@ async fn send_response(url: Url, stream: &mut TlsStream<TcpStream>) -> Result { } // Do not serve anything that looks like a hidden file. - if !ARGS.serve_secret && path.file_name().map_or(false, |name| { - name.to_str().map_or(false, |name| name.starts_with(".")) - }) { + if !ARGS.serve_secret + && path + .iter() + .filter_map(|component| component.to_str()) + .any(|component| component.starts_with(".")) + { return send_header(stream, 52, &["If I told you, it would not be a secret."]).await; }