mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
usbobserver: use surrogateescape for undecodable file names
This commit is contained in:
parent
5f4437f7fa
commit
d17c1c6ce8
@ -283,7 +283,11 @@ usbobserver_get_mounted_filesystems(PyObject *self, PyObject *args) {
|
||||
|
||||
for (i = 0 ; i < num; i++) {
|
||||
val = PyUnicode_FromString(buf[i].f_mntonname);
|
||||
if (!val) {
|
||||
PyErr_Clear();
|
||||
val = PyUnicode_DecodeLocale(buf[i].f_mntonname, "surrogateescape");
|
||||
if (!val) { NUKE(ans); goto end; }
|
||||
}
|
||||
if (PyDict_SetItemString(ans, buf[i].f_mntfromname, val) != 0) { NUKE(ans); NUKE(val); goto end; }
|
||||
NUKE(val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user