mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 11:59:48 -05:00
parent
ffe067f9da
commit
525129ddcb
1 changed files with 4 additions and 2 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue