[pbs-devel] [PATCH v3 backup 1/2] pxar: Adopt FileType enum when creating a ZipEntry

Filip Schauer f.schauer at proxmox.com
Thu Dec 14 15:48:23 CET 2023


Use a FileType enum instead of a boolean to specify whether a ZipEntry
refers to a directory or a regular file.

Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 pbs-client/src/pxar/extract.rs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index f78e06c2..d8bbd3e1 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -24,7 +24,7 @@ use proxmox_io::{sparse_copy, sparse_copy_async};
 use proxmox_sys::c_result;
 use proxmox_sys::fs::{create_path, CreateOptions};
 
-use proxmox_compression::zip::{ZipEncoder, ZipEntry};
+use proxmox_compression::zip::{FileType, ZipEncoder, ZipEntry};
 
 use crate::pxar::dir_stack::PxarDirStack;
 use crate::pxar::metadata;
@@ -997,7 +997,7 @@ where
                 path,
                 metadata.stat.mtime.secs,
                 metadata.stat.mode as u16,
-                false,
+                FileType::Directory,
             );
             zip.add_entry::<FileContents<T>>(entry, None).await?;
         }
@@ -1016,7 +1016,7 @@ where
                         path,
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
-                        true,
+                        FileType::Regular,
                     );
                     zip.add_entry(entry, decoder.contents())
                         .await
@@ -1034,7 +1034,7 @@ where
                         path,
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
-                        true,
+                        FileType::Regular,
                     );
                     zip.add_entry(entry, decoder.contents())
                         .await
@@ -1046,7 +1046,7 @@ where
                         path,
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
-                        false,
+                        FileType::Directory,
                     );
                     zip.add_entry::<FileContents<T>>(entry, None).await?;
                 }
-- 
2.39.2





More information about the pbs-devel mailing list