[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

upload: check that directory is a directory

vielle.dev 97aab937 ccdf5e10

verified
Changed files
+13 -5
upload
src
+13 -5
upload/src/config.rs
··· 1 + use std::fs; 2 + 1 3 pub struct Config { 2 4 pub user: String, 3 5 pub pword: String, ··· 39 41 && let Some(pword) = pword.clone() 40 42 && let Some(dir) = dir.clone() 41 43 { 42 - return Ok(Config { 43 - user, 44 - pword, 45 - dir: dir.to_owned(), 46 - }); 44 + if let Ok(metadata) = fs::metadata(dir.clone()) 45 + && metadata.is_dir() 46 + { 47 + return Ok(Config { 48 + user, 49 + pword, 50 + dir: dir.to_owned(), 51 + }); 52 + } else { 53 + return Err(ConfigErr::NotADirectory); 54 + } 47 55 } 48 56 49 57 return Err(ConfigErr::NotEnoughArgs(String::from(