From d5e54cb57684cc1a04ea7b0ce2118c672b10b0b0 Mon Sep 17 00:00:00 2001 From: Stefan Melmuk Date: Tue, 22 Nov 2022 05:46:51 +0100 Subject: [PATCH] only check sqlite parent if there could be one --- src/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index 51dba499..fe98d2df 100644 --- a/src/config.rs +++ b/src/config.rs @@ -639,11 +639,11 @@ make_config! { fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { // Validate connection URL is valid and DB feature is enabled let url = &cfg.database_url; - if DbConnType::from_url(url)? == DbConnType::sqlite { + if DbConnType::from_url(url)? == DbConnType::sqlite && url.contains('/') { let path = std::path::Path::new(&url); if let Some(parent) = path.parent() { - if !parent.exists() { - err!(format!("SQLite database directory `{}` does not exist", parent.display())); + if !parent.is_dir() { + err!(format!("SQLite database directory `{}` does not exist or is not a directory", parent.display())); } } }