settings: write theme files as binaries (#36515)

This commit is contained in:
Frédéric Péters 2019-11-16 15:33:58 +01:00
parent dbec13c73d
commit b73c5cc666
1 changed files with 2 additions and 2 deletions

View File

@ -750,7 +750,7 @@ class SettingsDirectory(QommonSettingsDirectory):
get_session().message = ('error', _('Theme is missing a desc.xml file.'))
return redirect('themes')
desc_xml = z.read('%s/desc.xml' % theme_name)
theme_dict = template.get_theme_dict(StringIO(desc_xml))
theme_dict = template.get_theme_dict(StringIO(force_text(desc_xml)))
if theme_dict.get('name') != theme_name:
get_session().message = ('error', _('desc.xml is missing a name attribute.'))
return redirect('themes')
@ -763,7 +763,7 @@ class SettingsDirectory(QommonSettingsDirectory):
data = z.read(f)
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
open(path, 'w').write(data)
open(path, 'wb').write(data)
z.close()
return redirect('themes')