From ceea2e485f7b4e6d822313191b6151bb91f35bd6 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Thu, 28 Mar 2024 13:36:27 +0100 Subject: [PATCH] client: backup: early check for fixed index type Early return when the check fails, avoiding constuction of unused object instances. Signed-off-by: Christian Ebner --- proxmox-backup-client/src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index 14870897..9dbd3cd1 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -192,6 +192,10 @@ async fn backup_directory>( pxar_create_options: pbs_client::pxar::PxarCreateOptions, upload_options: UploadOptions, ) -> Result { + 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>( } }); - 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)