[PATCH storage 1/1] api2: download-url: add allow-overwrite option

Sebastian Fleer dev at dwurp.de
Mon Mar 6 15:31:23 CET 2023


PVE::Tools::download_file_from_url already supports allow_overwrite,
expose this option via the API.

Signed-off-by: Sebastian Fleer <dev at dwurp.de>
---
 PVE/API2/Storage/Status.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm
index e028423..12e5356 100644
--- a/PVE/API2/Storage/Status.pm
+++ b/PVE/API2/Storage/Status.pm
@@ -590,6 +590,12 @@ __PACKAGE__->register_method({
 		optional => 1,
 		default => 1,
 	    },
+		'allow-overwrite' => {
+		description => "If true, overwriting existing files is allowed.",
+		type => 'boolean',
+		optional => 1,
+		default => 0,
+	    },
 	},
     },
     returns => {
@@ -638,6 +644,7 @@ __PACKAGE__->register_method({
 	my $opts = {
 	    hash_required => 0,
 	    verify_certificates => $param->{'verify-certificates'} // 1,
+		allow_overwrite => $param->{'allow-overwrite'} // 0,
 	    http_proxy => $dccfg->{http_proxy},
 	};
 
-- 
2.39.2





More information about the pve-devel mailing list