Blame SOURCES/0022-hawkey-surrogateescape-error-handler-to-decode-UTF-8-strings-RhBug1893176.patch

379fd8
From 263eee36afc0ae5c8f342f4b61038e91ee942b21 Mon Sep 17 00:00:00 2001
379fd8
From: Marek Blaha <mblaha@redhat.com>
379fd8
Date: Thu, 22 Apr 2021 15:19:26 +0200
379fd8
Subject: [PATCH] hawkey: surrogateescape error handler to decode UTF-8 strings (RhBug:1893176)
379fd8
379fd8
This ensures that libdnf does not raise UnicodeDecodeError when
379fd8
accessing package with non UTF-8 file names.
379fd8
379fd8
= changelog =
379fd8
msg:           DNF does not fail on non UTF-8 file names in a package
379fd8
type:          bugfix
379fd8
resolves:      https://bugzilla.redhat.com/show_bug.cgi?id=1893176
379fd8
---
379fd8
 python/hawkey/iutil-py.cpp | 2 +-
379fd8
 1 file changed, 1 insertion(+), 1 deletion(-)
379fd8
379fd8
diff --git a/python/hawkey/iutil-py.cpp b/python/hawkey/iutil-py.cpp
379fd8
index 56ccafd..57bef57 100644
379fd8
--- a/python/hawkey/iutil-py.cpp
379fd8
+++ b/python/hawkey/iutil-py.cpp
379fd8
@@ -285,7 +285,7 @@ strlist_to_pylist(const char **slist)
379fd8
         return NULL;
379fd8
 
379fd8
     for (const char **iter = slist; *iter; ++iter) {
379fd8
-        UniquePtrPyObject str(PyUnicode_FromString(*iter));
379fd8
+        UniquePtrPyObject str(PyUnicode_DecodeUTF8(*iter, strlen(*iter), "surrogateescape"));
379fd8
         if (!str)
379fd8
             return NULL;
379fd8
         int rc = PyList_Append(list.get(), str.get());
379fd8
--
379fd8
libgit2 1.0.1
379fd8