diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm index 349231d..c391b35 100644 --- a/PVE/API2/Storage/Content.pm +++ b/PVE/API2/Storage/Content.pm @@ -370,8 +370,8 @@ __PACKAGE__->register_method ({ 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; diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm index 7bb85e8..2267f11 100644 --- a/PVE/Storage/DirPlugin.pm +++ b/PVE/Storage/DirPlugin.pm @@ -107,8 +107,11 @@ sub update_volume_notes { 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; }