bin/src/routes/retrieve.rs
Gunwant Jain 9c5a3af128 refactor: bring in the modules
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
2021-07-11 03:07:50 +05:30

10 lines
No EOL
217 B
Rust

use std::fs::File;
use crate::models::paste_id::PasteId;
#[get("/<id>")]
pub async fn retrieve(id: PasteId<'_>) -> Option<File> {
let filename = format!("upload/{id}", id = id);
File::open(&filename).ok()
}