Remove limitation that prohibits segments from starting with '.'

The path "/.well-known", can be handy to use with Let's Encrypt, due
to the requirements of https://tools.ietf.org/html/rfc8555 which
inherits that name from https://tools.ietf.org/html/rfc5785

This commit removes the restriction that prevents actix-files::Files
from serving files from paths that contain a segment that starts with
a leading '.'
This commit is contained in:
Clifford T. Matthews 2020-02-23 11:51:15 -07:00
parent 3d6b8686ad
commit 66973ac237
1 changed files with 0 additions and 6 deletions

View File

@ -605,8 +605,6 @@ impl PathBufWrp {
for segment in path.split('/') { for segment in path.split('/') {
if segment == ".." { if segment == ".." {
buf.pop(); buf.pop();
} else if segment.starts_with('.') {
return Err(UriSegmentError::BadStart('.'));
} else if segment.starts_with('*') { } else if segment.starts_with('*') {
return Err(UriSegmentError::BadStart('*')); return Err(UriSegmentError::BadStart('*'));
} else if segment.ends_with(':') { } else if segment.ends_with(':') {
@ -1397,10 +1395,6 @@ mod tests {
#[actix_rt::test] #[actix_rt::test]
async fn test_path_buf() { async fn test_path_buf() {
assert_eq!(
PathBufWrp::get_pathbuf("/test/.tt").map(|t| t.0),
Err(UriSegmentError::BadStart('.'))
);
assert_eq!( assert_eq!(
PathBufWrp::get_pathbuf("/test/*tt").map(|t| t.0), PathBufWrp::get_pathbuf("/test/*tt").map(|t| t.0),
Err(UriSegmentError::BadStart('*')) Err(UriSegmentError::BadStart('*'))