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 <[email protected]>
---
 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: $!"
-- 
2.47.3



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to