refactor code and add dragover visual cue
Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
parent
a9dc9452fc
commit
cca3a8bec9
6 changed files with 273 additions and 232 deletions
|
|
@ -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()))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue