Correctly handle filesystem create errors
This commit is contained in:
parent
faef037bb3
commit
6d9b3fcbc6
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue