Previous to this we did not called the plugins update_volume_notes at
all in the case where a user delted the textarea, which results to
passing a falsy value ('').
Also adapt the currently sole implementation to delete the notes field
in the undef or '' value case. This can be done safely, as we default
to returning an empty string if no notes file exists.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE::Storage::check_volume_access($rpcenv, $authuser, $cfg, undef, $volid);
- if (my $notes = $param->{notes}) {
- PVE::Storage::update_volume_notes($cfg, $volid, $notes);
+ if (exists $param->{notes}) {
+ PVE::Storage::update_volume_notes($cfg, $volid, $param->{notes});
}
return undef;
my $path = $class->filesystem_path($scfg, $volname);
$path .= $class->SUPER::NOTES_EXT;
- PVE::Tools::file_set_contents($path, $notes);
-
+ if (defined($notes) && $notes ne '') {
+ PVE::Tools::file_set_contents($path, $notes);
+ } else {
+ unlink $path or die "could not delete notes - $!\n";
+ }
return;
}