From aace119790f92f691c586067f3554a842656c148 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Wed, 13 Jan 2021 09:55:54 -0500 Subject: [PATCH] Fix Python 3 issue with combining bytes and unicode. --- src/allmydata/web/root.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py index 5829da51e..e3d49cd66 100644 --- a/src/allmydata/web/root.py +++ b/src/allmydata/web/root.py @@ -243,9 +243,10 @@ class Root(MultiFormatResource): self.putChild(b"statistics", status.Statistics(client.stats_provider)) static_dir = resource_filename("allmydata.web", "static") for filen in os.listdir(static_dir): + child_path = filen if isinstance(filen, unicode): - filen = filen.encode("utf-8") - self.putChild(filen, static.File(os.path.join(static_dir, filen))) + child_path = filen.encode("utf-8") + self.putChild(child_path, static.File(os.path.join(static_dir, filen))) self.putChild(b"report_incident", IncidentReporter())