refactor code and add dragover visual cue
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use rocket::fs::NamedFile;
|
||||
use rocket::response::status::NotFound;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[get("/<file..>", rank = 3)]
|
||||
pub async fn static_files(file: PathBuf) -> Option<NamedFile> {
|
||||
NamedFile::open(Path::new("static/").join(file)).await.ok()
|
||||
pub async fn static_files(file: PathBuf) -> Result<NamedFile, NotFound<String>> {
|
||||
NamedFile::open(Path::new("static/").join(file))
|
||||
.await
|
||||
.map_err(|e| NotFound(e.to_string()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user