Fix Python 3 issue with combining bytes and unicode.

This commit is contained in:
Itamar Turner-Trauring 2021-01-13 09:55:54 -05:00
parent 6b0849490a
commit aace119790

View File

@ -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())