The following call could result in a broken encoding when a package
description contains unicode characters.

    pvesh get /nodes/localhost/apt/update

One potential example of such a package was libnbd0 where the character
'—' (em dash) was rendered as 'â'.

The file at /var/lib/pve-manager/pkgupdates would also have the wrong
encoding.

This patch fixes both issues.

Reported-by: Lukas Wagner <[email protected]>
Signed-off-by: Maximiliano Sandoval <[email protected]>
---

One unfortunate problem for reproducing this issue is that this particular
package is already on the latest version on the Proxmox VE 9.0 iso.

 PVE/API2/APT.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 0d07cf38..27842aa6 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -107,7 +107,7 @@ my $assemble_pkginfo = sub {
     if (my $desc = $info->{LongDesc}) {
         $desc =~ s/^.*\n\s?//; # remove first line
         $desc =~ s/\n / /g;
-        $data->{Description} = $desc;
+        $data->{Description} = decode('UTF-8', $desc);
     }
 
     foreach my $k (qw(Section Arch Priority)) {
-- 
2.47.3



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

Reply via email to