Merge branch 'master' into chore/bump_actix_deps

This commit is contained in:
Orhun Parmaksız 2022-03-16 16:54:12 +03:00
commit 284481e560
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90
1 changed files with 4 additions and 2 deletions

View File

@ -50,10 +50,12 @@ async fn serve(
}
}
}
if !path.is_file() || !path.exists() {
return Err(error::ErrorNotFound("file is not found or expired :("));
}
match paste_type {
PasteType::File | PasteType::RemoteFile | PasteType::Oneshot => {
let response = NamedFile::open(&path)
.map_err(|_| error::ErrorNotFound("file is not found or expired :("))?
let response = NamedFile::open(&path)?
.disable_content_disposition()
.set_content_type(
mime::get_mime_type(&config.paste.mime_override, file.to_string())