Skip to content

Commit

Permalink
Correctly handle filesystem create errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Mar 4, 2024
1 parent faef037 commit 6d9b3fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6d9b3fc

Please sign in to comment.