]> git.proxmox.com Git - proxmox-backup.git/commitdiff
client: backup: early check for fixed index type
authorChristian Ebner <c.ebner@proxmox.com>
Thu, 28 Mar 2024 12:36:27 +0000 (13:36 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 4 Apr 2024 08:54:06 +0000 (10:54 +0200)
Early return when the check fails, avoiding constuction of unused
object instances.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
proxmox-backup-client/src/main.rs

index 148708976f5e4a2c23774176514ca951cce31284..9dbd3cd1ab5c234713ca42b85c6f0f3edc95db16 100644 (file)
@@ -192,6 +192,10 @@ async fn backup_directory<P: AsRef<Path>>(
     pxar_create_options: pbs_client::pxar::PxarCreateOptions,
     upload_options: UploadOptions,
 ) -> Result<BackupStats, Error> {
+    if upload_options.fixed_size.is_some() {
+        bail!("cannot backup directory with fixed chunk size!");
+    }
+
     let pxar_stream = PxarBackupStream::open(dir_path.as_ref(), catalog, pxar_create_options)?;
     let mut chunk_stream = ChunkStream::new(pxar_stream, chunk_size);
 
@@ -206,9 +210,6 @@ async fn backup_directory<P: AsRef<Path>>(
         }
     });
 
-    if upload_options.fixed_size.is_some() {
-        bail!("cannot backup directory with fixed chunk size!");
-    }
 
     let stats = client
         .upload_stream(archive_name, stream, upload_options)