* Fixing broken 'missing thumbnail' default
* Fixing frontend TS to accomodate for new thumbnail uri path's
This commit is contained in:
@@ -7,16 +7,21 @@ pub async fn get(file: PathBuf) -> Option<NamedFile> {
|
||||
let clips_dir = thumbs_dir();
|
||||
|
||||
// Only serve jpg's and png's through this route
|
||||
return match file.extension() {
|
||||
Some(ext) => {
|
||||
if ext == "jpg" || ext == "png" || ext == "jpeg" {
|
||||
println!("Found it");
|
||||
NamedFile::open(Path::new(&clips_dir).join(file)).await.ok()
|
||||
} else {
|
||||
println!("bad extension");
|
||||
None
|
||||
}
|
||||
},
|
||||
None => None
|
||||
let file_path = Path::new(&clips_dir).join(file);
|
||||
if file_path.is_file() {
|
||||
return match file_path.extension() {
|
||||
Some(ext) => {
|
||||
if ext == "jpg" || ext == "png" || ext == "jpeg" {
|
||||
NamedFile::open(file_path).await.ok()
|
||||
} else {
|
||||
println!("bad extension");
|
||||
None
|
||||
}
|
||||
},
|
||||
None => None
|
||||
}
|
||||
} else {
|
||||
let path = Path::new("static/cantfindshit.gif");
|
||||
return NamedFile::open(path).await.ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user