mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
fix starting the server when db/media dirs do not exist yet
This used to be supported, as we explicitly call std::fs::create_dir_all
when initializing these, but it was broken in
b01b70fc20, which attempts to canonicalize
the paths to check for overlap before creating them.
This commit is contained in:
parent
abb1b5681e
commit
33f3592612
2 changed files with 6 additions and 7 deletions
|
|
@ -15,7 +15,7 @@ use ruma::{
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use strum::{Display, EnumIter, IntoEnumIterator};
|
use strum::{Display, EnumIter, IntoEnumIterator};
|
||||||
|
|
||||||
use crate::error;
|
use crate::{error, utils::partial_canonicalize};
|
||||||
|
|
||||||
mod env_filter_clone;
|
mod env_filter_clone;
|
||||||
mod proxy;
|
mod proxy;
|
||||||
|
|
@ -548,13 +548,13 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
if !sandboxed {
|
if !sandboxed {
|
||||||
let media_path = x
|
let media_path = partial_canonicalize(&x.path)
|
||||||
.path
|
.await
|
||||||
.canonicalize()
|
|
||||||
.map_err(|e| Error::Canonicalize(e, x.path.clone()))?;
|
.map_err(|e| Error::Canonicalize(e, x.path.clone()))?;
|
||||||
|
|
||||||
let database_path =
|
let database_path = partial_canonicalize(&config.database.path)
|
||||||
config.database.path.canonicalize().map_err(|e| {
|
.await
|
||||||
|
.map_err(|e| {
|
||||||
Error::Canonicalize(e, config.database.path.clone())
|
Error::Canonicalize(e, config.database.path.clone())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,6 @@ pub(crate) fn u8_slice_to_hex(slice: &[u8]) -> String {
|
||||||
/// It's assumed that non-existent components will be created as
|
/// It's assumed that non-existent components will be created as
|
||||||
/// directories. This should match the result of [`fs::canonicalize`]
|
/// directories. This should match the result of [`fs::canonicalize`]
|
||||||
/// _after_ calling [`fs::create_dir_all`] on `path`.
|
/// _after_ calling [`fs::create_dir_all`] on `path`.
|
||||||
#[allow(dead_code)]
|
|
||||||
pub(crate) async fn partial_canonicalize(path: &Path) -> io::Result<PathBuf> {
|
pub(crate) async fn partial_canonicalize(path: &Path) -> io::Result<PathBuf> {
|
||||||
let mut ret = std::env::current_dir()?;
|
let mut ret = std::env::current_dir()?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue