]> git.proxmox.com Git - proxmox-backup.git/commitdiff
file-restore: don't list non-pxar/-img *idx archives
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 21 Apr 2021 13:18:06 +0000 (15:18 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Apr 2021 15:18:06 +0000 (17:18 +0200)
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 <s.reiter@proxmox.com>
src/bin/proxmox-file-restore.rs

index c9ef3912364b444cc1a62bbb6f137d8d9caa1391..36fdd391b1280957995ce2b46c451b98777949e2 100644 (file)
@@ -56,7 +56,7 @@ fn parse_path(path: String, base64: bool) -> Result<ExtractPath, Error> {
         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 };