diff --git a/Cargo.lock b/Cargo.lock
index cd50fd5..81a4554 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1101,7 +1101,7 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "wrestic"
-version = "1.2.6"
+version = "1.2.7"
dependencies = [
"anyhow",
"clap",
diff --git a/Cargo.toml b/Cargo.toml
index 863faa3..83d2d59 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "wrestic"
-version = "1.2.6"
+version = "1.2.7"
authors = ["alvaro17f"]
description = "Restic wrapper built in Rust"
homepage = "https://github.com/alvaro17f/wrestic"
diff --git a/src/modules/restore.rs b/src/modules/restore.rs
index c93e9da..71c31dd 100644
--- a/src/modules/restore.rs
+++ b/src/modules/restore.rs
@@ -17,6 +17,7 @@ fn do_restore(
repository: &str,
restore_folder: &str,
restore_snapshot: &str,
+ user: &str,
) -> Result<()> {
if run_cmd!(
restic -r $backend:$repository --verbose --verbose restore $restore_snapshot --target $restore_folder;
@@ -25,6 +26,9 @@ fn do_restore(
{
cprintln!("Failed to restore snapshot: {restore_snapshot} into: {restore_folder}");
}
+ if run_cmd!(chown -R $user:$user $restore_folder).is_err() {
+ cprintln!("Failed to change ownership of: {restore_folder}");
+ }
Ok(())
}
@@ -58,6 +62,7 @@ pub fn restore(noconfirm: bool) -> Result<()> {
let repository = &settings[selection].repository;
let restore_folder = &settings[selection].restore_folder;
let restore_snapshot = snapshots_selector(backend, repository)?;
+ let user = &settings[selection].user;
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt(cformat!(
@@ -66,7 +71,7 @@ pub fn restore(noconfirm: bool) -> Result<()> {
.default(true)
.interact()?
{
- do_restore(backend, repository, restore_folder, &restore_snapshot)?;
+ do_restore(backend, repository, restore_folder, &restore_snapshot, user)?;
pause()?;
}
if !noconfirm {
diff --git a/src/utils/get_config.rs b/src/utils/get_config.rs
index b2b2285..d29d789 100644
--- a/src/utils/get_config.rs
+++ b/src/utils/get_config.rs
@@ -73,6 +73,7 @@ pub fn get_config() -> Result> {
.build()?;
let user = find_config_file()
+ .unwrap()
.iter()
.nth(2)
.and_then(|f| f.to_str())
@@ -87,7 +88,7 @@ pub fn get_config() -> Result> {
let deserialized_value = value.clone().try_deserialize::()?;
let settings_struct = Settings {
- user: user.clone(),
+ user: user.clone().replace('\"', ""),
name: key.to_string().replace('\"', ""),
backend: deserialized_value