mirror of
https://github.com/YGGverse/agate.git
synced 2026-04-08 20:45:29 +00:00
check all path components
This commit is contained in:
parent
af783f6911
commit
681ba770a1
1 changed files with 6 additions and 3 deletions
|
|
@ -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.
|
// Do not serve anything that looks like a hidden file.
|
||||||
if !ARGS.serve_secret && path.file_name().map_or(false, |name| {
|
if !ARGS.serve_secret
|
||||||
name.to_str().map_or(false, |name| name.starts_with("."))
|
&& 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;
|
return send_header(stream, 52, &["If I told you, it would not be a secret."]).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue