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:
Ali MJ Al-Nasrawy 2021-04-12 14:24:55 +03:00 committed by GitHub
parent 981c54432c
commit d519a28c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -83,10 +83,10 @@ impl Service<ServiceRequest> for FilesService {
};
// full file path
let path = match self.directory.join(&real_path).canonicalize() {
Ok(path) => path,
Err(err) => return Box::pin(self.handle_err(err, req)),
};
let path = self.directory.join(&real_path);
if let Err(err) = path.canonicalize() {
return Box::pin(self.handle_err(err, req));
}
if path.is_dir() {
if let Some(ref redir_index) = self.index {