Use b''.decode() instead of str(b'') (#941)

Handling of request arguments in WizardRequestHandler is not decoding
bytes and rather just doing a str conversion resulting in a value of
"b''" being supplied to the wizard code.
This commit is contained in:
Tim Savage 2020-01-10 08:23:25 +11:00 committed by Brandon Davidson
parent a6d31f05ee
commit 45630d74f3

View File

@ -325,7 +325,10 @@ class WizardRequestHandler(BaseHandler):
def post(self): def post(self):
from esphome import wizard from esphome import wizard
kwargs = {k: ''.join(str(x) for x in v) for k, v in self.request.arguments.items()} kwargs = {
k: ''.join(x.decode() for x in v)
for k, v in self.request.arguments.items()
}
destination = settings.rel_path(kwargs['name'] + '.yaml') destination = settings.rel_path(kwargs['name'] + '.yaml')
wizard.wizard_write(path=destination, **kwargs) wizard.wizard_write(path=destination, **kwargs)
self.redirect('./?begin=True') self.redirect('./?begin=True')