mirror of https://github.com/fafhrd91/actix-web
files: Don't use canonical path when serving file
Otherwise, for symlink files, the content-disposition header would be set to the filename of the pointed-to file. Fixes #2128.
This commit is contained in:
parent
981c54432c
commit
d519a28c50
|
@ -83,10 +83,10 @@ impl Service<ServiceRequest> for FilesService {
|
||||||
};
|
};
|
||||||
|
|
||||||
// full file path
|
// full file path
|
||||||
let path = match self.directory.join(&real_path).canonicalize() {
|
let path = self.directory.join(&real_path);
|
||||||
Ok(path) => path,
|
if let Err(err) = path.canonicalize() {
|
||||||
Err(err) => return Box::pin(self.handle_err(err, req)),
|
return Box::pin(self.handle_err(err, req));
|
||||||
};
|
}
|
||||||
|
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
if let Some(ref redir_index) = self.index {
|
if let Some(ref redir_index) = self.index {
|
||||||
|
|
Loading…
Reference in New Issue