mirror of https://github.com/fafhrd91/actix-web
Fix `redirect_to_slash_directory()`
This commit is contained in:
parent
b1de196509
commit
e5c178994c
|
@ -89,8 +89,10 @@ impl Service<ServiceRequest> for FilesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
if let Some(ref redir_index) = self.index {
|
if self.redirect_to_slash
|
||||||
if self.redirect_to_slash && !req.path().ends_with('/') {
|
&& !req.path().ends_with('/')
|
||||||
|
&& (self.index.is_some() || self.show_index)
|
||||||
|
{
|
||||||
let redirect_to = format!("{}/", req.path());
|
let redirect_to = format!("{}/", req.path());
|
||||||
|
|
||||||
return Box::pin(ok(req.into_response(
|
return Box::pin(ok(req.into_response(
|
||||||
|
@ -100,6 +102,7 @@ impl Service<ServiceRequest> for FilesService {
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(ref redir_index) = self.index {
|
||||||
let path = path.join(redir_index);
|
let path = path.join(redir_index);
|
||||||
|
|
||||||
match NamedFile::open(path) {
|
match NamedFile::open(path) {
|
||||||
|
|
Loading…
Reference in New Issue