mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09: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 {
|
match paste_type {
|
||||||
PasteType::File | PasteType::RemoteFile | PasteType::Oneshot => {
|
PasteType::File | PasteType::RemoteFile | PasteType::Oneshot => {
|
||||||
let response = NamedFile::open(&path)
|
let response = NamedFile::open(&path)?
|
||||||
.map_err(|_| error::ErrorNotFound("file is not found or expired :("))?
|
|
||||||
.disable_content_disposition()
|
.disable_content_disposition()
|
||||||
.set_content_type(
|
.set_content_type(
|
||||||
mime::get_mime_type(&config.paste.mime_override, file.to_string())
|
mime::get_mime_type(&config.paste.mime_override, file.to_string())
|
||||||
|
|
Loading…
Reference in a new issue