From 0ed80aaf31551f66fd05753dbdd7d8a398684193 Mon Sep 17 00:00:00 2001 From: Filip Schauer Date: Mon, 17 Nov 2025 18:13:15 +0100 Subject: [PATCH] api: oci image pull: do not pull OCI image if file already exists This ensures that the API call fails early, before pulling the OCI image from the registry and then failing to rename the temporary file. Signed-off-by: Filip Schauer Link: https://lore.proxmox.com/20251117171528.262443-3-f.schauer@proxmox.com Signed-off-by: Thomas Lamprecht --- src/PVE/API2/Storage/Status.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm index 96832b9..9fb6141 100644 --- a/src/PVE/API2/Storage/Status.pm +++ b/src/PVE/API2/Storage/Status.pm @@ -964,6 +964,8 @@ __PACKAGE__->register_method({ my $path = PVE::Storage::get_vztmpl_dir($cfg, $storage); PVE::Storage::activate_storage($cfg, $storage); + die "refusing to override existing file '$filename'\n" if (-f "$path/$filename"); + local $SIG{INT} = sub { unlink "$path/$tmp_filename" or warn "could not cleanup temporary file: $!"