mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
style(paste): use a custom 404 message while serving files
This commit is contained in:
parent
73359f3534
commit
7a510bc2ad
1 changed files with 2 additions and 1 deletions
|
@ -43,7 +43,8 @@ async fn serve(
|
||||||
}
|
}
|
||||||
match paste_type {
|
match paste_type {
|
||||||
PasteType::File | PasteType::Oneshot => {
|
PasteType::File | 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