From 9b2f5df4d594ac1e88555def45ca59c2d6f4fd5c Mon Sep 17 00:00:00 2001 From: Agate Date: Thu, 23 Apr 2020 11:14:52 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20SPA=C2=A0decoding=20error=20when=20loca?= =?UTF-8?q?le=20isn't=20set=20on=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/funkwhale_api/common/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/funkwhale_api/common/middleware.py b/api/funkwhale_api/common/middleware.py index 7f82ae20c..1143255e3 100644 --- a/api/funkwhale_api/common/middleware.py +++ b/api/funkwhale_api/common/middleware.py @@ -101,8 +101,8 @@ def get_spa_file(spa_url, name): # strip the filename path = os.path.join(os.path.dirname(spa_url), name) # we try to open a local file - with open(path) as f: - return f.read() + with open(path, "rb") as f: + return f.read().decode("utf-8") cache_key = "spa-file:{}:{}".format(spa_url, name) cached = caches["local"].get(cache_key) if cached: