[pbs-devel] [PATCH proxmox-backup 4/4] file-restore: allow extracting a full pxar archive
Stefan Reiter
s.reiter at proxmox.com
Wed Apr 21 15:18:09 CEST 2021
If the path for within the archive is empty, assume "/" to extract all
of it.
Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
src/bin/proxmox-file-restore.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/bin/proxmox-file-restore.rs b/src/bin/proxmox-file-restore.rs
index 7799a76d..2726eeb7 100644
--- a/src/bin/proxmox-file-restore.rs
+++ b/src/bin/proxmox-file-restore.rs
@@ -399,14 +399,16 @@ async fn extract_to_target<T>(
where
T: pxar::accessor::ReadAt + Clone + Send + Sync + Unpin + 'static,
{
+ let path = if path.is_empty() { b"/" } else { path };
+
let root = decoder.open_root().await?;
let file = root
- .lookup(OsStr::from_bytes(&path))
+ .lookup(OsStr::from_bytes(path))
.await?
.ok_or_else(|| format_err!("error opening '{:?}'", path))?;
if let Some(target) = target {
- extract_sub_dir(target, decoder, OsStr::from_bytes(&path), verbose).await?;
+ extract_sub_dir(target, decoder, OsStr::from_bytes(path), verbose).await?;
} else {
match file.kind() {
pxar::EntryKind::File { .. } => {
@@ -416,7 +418,7 @@ where
create_zip(
tokio::io::stdout(),
decoder,
- OsStr::from_bytes(&path),
+ OsStr::from_bytes(path),
verbose,
)
.await?;
--
2.20.1
More information about the pbs-devel
mailing list