0
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden synced 2024-11-05 07:08:59 +01:00

only check sqlite parent if there could be one

This commit is contained in:
Stefan Melmuk 2022-11-22 05:46:51 +01:00
parent 2f9d7060bd
commit 5a13efefd3
No known key found for this signature in database
GPG key ID: 817020C608FE9C09

View file

@ -631,11 +631,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()));
}
}
}