]> git.proxmox.com Git - pve-cluster.git/commitdiff
cluster fs: allow to force UTF-8 encoding for cfs_write_file
authorLukas Wagner <l.wagner@proxmox.com>
Wed, 30 Aug 2023 12:37:53 +0000 (14:37 +0200)
committerFiona Ebner <f.ebner@proxmox.com>
Mon, 11 Sep 2023 11:41:50 +0000 (13:41 +0200)
Since this function is used to store utf8-encoded strings that come
from Rust, we need to be able to save the file in proper utf8 encoding
as well.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
[FE: use flag parameter instead of encoding as a string]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
src/PVE/Cluster.pm

index e3705b66d8b09806c08da35dbbf670c423193a31..cfa258347740352019b786e64ddaa290b993b15d 100644 (file)
@@ -578,7 +578,7 @@ sub cfs_read_file {
 }
 
 sub cfs_write_file {
-    my ($filename, $data) = @_;
+    my ($filename, $data, $force_utf8) = @_;
 
     my ($version, $info) = cfs_file_version($filename);
 
@@ -592,7 +592,7 @@ sub cfs_write_file {
        $ci->{version} = undef;
     }
 
-    PVE::Tools::file_set_contents($fsname, $raw);
+    PVE::Tools::file_set_contents($fsname, $raw, undef, 1);
 }
 
 my $cfs_lock = sub {