X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FStorage%2FDirPlugin.pm;fp=PVE%2FStorage%2FDirPlugin.pm;h=53eb6423c32320691a833231538c0dd1b942a8d9;hb=43f8112f0bb424f99057106d57d32276d7d422a6;hp=1baad63aa8550032d738f6300ef4f5b8b5d2e150;hpb=7a8751a2cd9255ff4d26cd96e21b26fc64c83706;p=pve-storage.git diff --git a/PVE/Storage/DirPlugin.pm b/PVE/Storage/DirPlugin.pm index 1baad63..53eb642 100644 --- a/PVE/Storage/DirPlugin.pm +++ b/PVE/Storage/DirPlugin.pm @@ -4,6 +4,7 @@ use strict; use warnings; use Cwd; +use Encode qw(decode encode); use File::Path; use IO::File; use POSIX; @@ -104,7 +105,10 @@ sub get_volume_notes { my $path = $class->filesystem_path($scfg, $volname); $path .= $class->SUPER::NOTES_EXT; - return PVE::Tools::file_get_contents($path) if -f $path; + if (-f $path) { + my $data = PVE::Tools::file_get_contents($path); + return eval { decode('UTF-8', $data, 1) } // $data; + } return ''; } @@ -121,7 +125,8 @@ sub update_volume_notes { $path .= $class->SUPER::NOTES_EXT; if (defined($notes) && $notes ne '') { - PVE::Tools::file_set_contents($path, $notes); + my $encoded = encode('UTF-8', $notes); + PVE::Tools::file_set_contents($path, $encoded); } else { unlink $path or $! == ENOENT or die "could not delete notes - $!\n"; }