Correctly handle filesystem create errors

This commit is contained in:
Jake Howard 2024-03-04 19:20:49 +00:00
parent faef037bb3
commit 6d9b3fcbc6
No known key found for this signature in database
GPG Key ID: 57AFB45680EDD477
1 changed files with 3 additions and 3 deletions

View File

@ -71,13 +71,13 @@ fn setup(config_folder: &Path) -> IoResult<(Data<RwLock<Config>>, ServerConfig,
// Create necessary directories.
fs::create_dir_all(&server_config.upload_path)?;
for paste_type in &[PasteType::Url, PasteType::Oneshot, PasteType::OneshotUrl] {
let _ = paste_type
let upload_path = paste_type
.get_path(&server_config.upload_path)
.ok_or(IoError::new(
IoErrorKind::Other,
String::from("Invalid upload path"),
))
.map(fs::create_dir_all)?;
))?;
fs::create_dir_all(upload_path)?;
}
// Set up a watcher for the configuration file changes.