canonicalize paths before normalization, fix symlink bug

feat/vaults
Tomáš Mládek 2022-01-23 14:51:54 +01:00
parent 893a87a094
commit dd16a96125
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ impl UpEndDatabase {
let db = UpEndDatabase {
pool,
vault_path: Arc::new(PathBuf::from(dirpath.as_ref())),
vault_path: Arc::new(dirpath.as_ref().canonicalize()?),
db_path: Arc::new(upend_path),
};
let connection = db.connection().unwrap();
@ -250,7 +250,7 @@ impl UpEndConnection {
}
pub fn normalize_path(&self, path: &Path) -> Result<PathBuf> {
Ok(path.strip_prefix(self.vault_path.as_path())?.to_path_buf())
Ok(path.canonicalize()?.strip_prefix(self.vault_path.as_path())?.to_path_buf())
}
pub fn retrieve_entry(&self, hash: Hash) -> Result<Option<Entry>> {