From d356356111977c06e4227011aed919ca4ab2df74 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 3 Mar 2017 11:59:50 -0600 Subject: [PATCH] Fix #2466: GIO returns bytes, so decode them --- beetsplug/thumbnails.py | 8 +++++++- docs/changelog.rst | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/beetsplug/thumbnails.py b/beetsplug/thumbnails.py index 1ea90f01e..838206156 100644 --- a/beetsplug/thumbnails.py +++ b/beetsplug/thumbnails.py @@ -289,4 +289,10 @@ class GioURI(URIGetter): raise finally: self.libgio.g_free(uri_ptr) - return uri + + try: + return uri.decode(util._fsencoding()) + except UnicodeDecodeError: + raise RuntimeError( + "Could not decode filename from GIO: {!r}".format(uri) + ) diff --git a/docs/changelog.rst b/docs/changelog.rst index 2ceed486d..7e86755fb 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -59,6 +59,8 @@ Fixes: ``copy`` and ``move`` options. :bug:`2444` * :doc:`/plugins/mbsubmit`: The tracks are now sorted. Thanks to :user:`awesomer`. :bug:`2457` +* :doc:`/plugins/thumbnails`: Fix a string-related crash on Python 3. + :bug:`2466` 1.4.3 (January 9, 2017)