From 2fd2d2928125bad87b1b4fded3e45f023be82104 Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Wed, 21 Apr 2021 15:18:06 +0200 Subject: [PATCH] file-restore: don't list non-pxar/-img *idx archives These can't be entered or restored anyway, and cause issues with catalog files for example. Also a clippy fix. Signed-off-by: Stefan Reiter --- src/bin/proxmox-file-restore.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/bin/proxmox-file-restore.rs b/src/bin/proxmox-file-restore.rs index c9ef39123..36fdd391b 100644 --- a/src/bin/proxmox-file-restore.rs +++ b/src/bin/proxmox-file-restore.rs @@ -56,7 +56,7 @@ fn parse_path(path: String, base64: bool) -> Result { return Ok(ExtractPath::ListArchives); } - while bytes.len() > 0 && bytes[0] == b'/' { + while !bytes.is_empty() && bytes[0] == b'/' { bytes.remove(0); } @@ -170,10 +170,8 @@ async fn list( ExtractPath::ListArchives => { let mut entries = vec![]; for file in manifest.files() { - match file.filename.rsplitn(2, '.').next().unwrap() { - "didx" => {} - "fidx" => {} - _ => continue, // ignore all non fidx/didx + if !file.filename.ends_with(".pxar.didx") && !file.filename.ends_with(".img.fidx") { + continue; } let path = format!("/{}", file.filename); let attr = DirEntryAttribute::Directory { start: 0 };