mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
don't check canonicalized paths while sandboxed
Because the configured paths won't exist in the sandbox, so canonicalization would fail.
This commit is contained in:
parent
50583bc93e
commit
a04951541a
5 changed files with 30 additions and 19 deletions
|
|
@ -514,7 +514,10 @@ fn search() -> Result<PathBuf, error::ConfigSearch> {
|
|||
}
|
||||
|
||||
/// Load the configuration from the given path or XDG Base Directories
|
||||
pub(crate) async fn load<P>(path: Option<P>) -> Result<Config, error::Config>
|
||||
pub(crate) async fn load<P>(
|
||||
path: Option<P>,
|
||||
sandboxed: bool,
|
||||
) -> Result<Config, error::Config>
|
||||
where
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
|
|
@ -544,18 +547,20 @@ where
|
|||
return Err(Error::DatabaseMediaOverlap);
|
||||
}
|
||||
|
||||
let media_path = x
|
||||
.path
|
||||
.canonicalize()
|
||||
.map_err(|e| Error::Canonicalize(e, x.path.clone()))?;
|
||||
if !sandboxed {
|
||||
let media_path = x
|
||||
.path
|
||||
.canonicalize()
|
||||
.map_err(|e| Error::Canonicalize(e, x.path.clone()))?;
|
||||
|
||||
let database_path =
|
||||
config.database.path.canonicalize().map_err(|e| {
|
||||
Error::Canonicalize(e, config.database.path.clone())
|
||||
})?;
|
||||
let database_path =
|
||||
config.database.path.canonicalize().map_err(|e| {
|
||||
Error::Canonicalize(e, config.database.path.clone())
|
||||
})?;
|
||||
|
||||
if overlap(&media_path, &database_path) {
|
||||
return Err(Error::DatabaseMediaOverlap);
|
||||
if overlap(&media_path, &database_path) {
|
||||
return Err(Error::DatabaseMediaOverlap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue