From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 56AA21FF3A0 for ; Thu, 13 Jun 2024 12:55:48 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2531A1EB60; Thu, 13 Jun 2024 12:56:25 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 13 Jun 2024 12:56:03 +0200 Message-Id: <20240613105605.283550-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240613105605.283550-1-c.ebner@proxmox.com> References: <20240613105605.283550-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH v3 proxmox-backup 2/4] pxar: bin: use dedicated api type for restore pattern X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Instead of taking a plain string as input parameter, use the corresponding api type performing additional input validation. Signed-off-by: Christian Ebner --- changes since version 2: - not present pxar-bin/Cargo.toml | 1 + pxar-bin/src/main.rs | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml index bb010ff78..aa53a1cf0 100644 --- a/pxar-bin/Cargo.toml +++ b/pxar-bin/Cargo.toml @@ -25,6 +25,7 @@ proxmox-router = { workspace = true, features = ["cli", "server"] } proxmox-schema = { workspace = true, features = [ "api-macro" ] } proxmox-sys.workspace = true +pbs-api-types.workspace = true pbs-client.workspace = true pbs-pxar-fuse.workspace = true pbs-tools.workspace = true diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs index e62348e25..1ec1ff13d 100644 --- a/pxar-bin/src/main.rs +++ b/pxar-bin/src/main.rs @@ -12,6 +12,7 @@ use futures::select; use tokio::signal::unix::{signal, SignalKind}; use pathpatterns::{MatchEntry, MatchType, PatternFlag}; +use pbs_api_types::PathPatterns; use pbs_client::pxar::{ format_single_line_entry, Flags, OverwriteFlags, PxarExtractOptions, PxarWriters, ENCODER_MAX_ENTRIES, @@ -52,12 +53,7 @@ fn extract_archive_from_reader( description: "Archive name.", }, pattern: { - description: "List of paths or pattern matching files to restore", - type: Array, - items: { - type: String, - description: "Path or pattern matching files to restore.", - }, + type: PathPatterns, optional: true, }, target: { @@ -143,7 +139,7 @@ fn extract_archive_from_reader( #[allow(clippy::too_many_arguments)] fn extract_archive( archive: String, - pattern: Option>, + pattern: Option, target: Option, no_xattrs: bool, no_fcaps: bool, -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel