Serving files is working

Right now we're not doing any streaming and this isn't ideal. I'll need
to figure it out at some point.
This commit is contained in:
Cameron Cordes
2020-07-08 21:38:21 -04:00
parent 82203d9a41
commit 536300e0a1
5 changed files with 121 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ pub fn list_files(dir: PathBuf) -> io::Result<Vec<PathBuf>> {
.filter(|entry| is_image_or_video(&entry.path()) || entry.file_type().unwrap().is_dir())
.map(|entry| entry.path())
.map(|path: PathBuf| {
let relative = path.strip_prefix(std::env::current_dir().unwrap()).unwrap();
let relative = path.strip_prefix(dotenv::var("BASE_PATH").unwrap()).unwrap();
relative.to_path_buf()
})
.collect::<Vec<PathBuf>>();