From: Stefan Reiter <s.reiter@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/4] file-restore: allow extracting a full pxar archive
Date: Wed, 21 Apr 2021 15:18:09 +0200 [thread overview]
Message-ID: <20210421131809.22607-5-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210421131809.22607-1-s.reiter@proxmox.com>
If the path for within the archive is empty, assume "/" to extract all
of it.
Signed-off-by: Stefan Reiter <s.reiter@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
next prev parent reply other threads:[~2021-04-21 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 13:18 [pbs-devel] [PATCH 0/4] Smaller fixes/changes for file-restore Stefan Reiter
2021-04-21 13:18 ` [pbs-devel] [PATCH RESEND proxmox-backup 1/4] file-restore: don't list non-pxar/-img *idx archives Stefan Reiter
2021-04-21 13:18 ` [pbs-devel] [PATCH proxmox-backup 2/4] file-restore: print warnings on stderr Stefan Reiter
2021-04-21 13:18 ` [pbs-devel] [PATCH proxmox-backup 3/4] file-restore: Add 'v' (Virtual) ArchiveEntry type Stefan Reiter
2021-04-21 13:18 ` Stefan Reiter [this message]
2021-04-21 15:26 ` [pbs-devel] applied: [PATCH 0/4] Smaller fixes/changes for file-restore Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210421131809.22607-5-s.reiter@proxmox.com \
--to=s.reiter@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox