mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Base64 python3 change
This commit is contained in:
parent
3bc45b5672
commit
a5508b1db4
1 changed files with 4 additions and 4 deletions
|
@ -1845,7 +1845,7 @@ def app_config_apply(operation_logger, app, args):
|
||||||
logger.warning(m18n.n("experimental_feature"))
|
logger.warning(m18n.n("experimental_feature"))
|
||||||
|
|
||||||
from yunohost.hook import hook_exec
|
from yunohost.hook import hook_exec
|
||||||
|
from base64 import b64decode
|
||||||
installed = _is_installed(app)
|
installed = _is_installed(app)
|
||||||
if not installed:
|
if not installed:
|
||||||
raise YunohostValidationError(
|
raise YunohostValidationError(
|
||||||
|
@ -1889,8 +1889,8 @@ def app_config_apply(operation_logger, app, args):
|
||||||
filename = args[generated_name + '[name]']
|
filename = args[generated_name + '[name]']
|
||||||
content = args[generated_name]
|
content = args[generated_name]
|
||||||
logger.debug("Save uploaded file %s from API into %s", filename, upload_dir)
|
logger.debug("Save uploaded file %s from API into %s", filename, upload_dir)
|
||||||
|
|
||||||
# Filename is given by user of the API. For security reason, we have replaced
|
# Filename is given by user of the API. For security reason, we have replaced
|
||||||
# os.path.join to avoid the user to be able to rewrite a file in filesystem
|
# os.path.join to avoid the user to be able to rewrite a file in filesystem
|
||||||
# i.e. os.path.join("/foo", "/etc/passwd") == "/etc/passwd"
|
# i.e. os.path.join("/foo", "/etc/passwd") == "/etc/passwd"
|
||||||
file_path = os.path.normpath(upload_dir + "/" + filename)
|
file_path = os.path.normpath(upload_dir + "/" + filename)
|
||||||
|
@ -1900,7 +1900,7 @@ def app_config_apply(operation_logger, app, args):
|
||||||
i += 1
|
i += 1
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'wb') as f:
|
with open(file_path, 'wb') as f:
|
||||||
f.write(content.decode("base64"))
|
f.write(b64decode(content))
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise YunohostError("cannot_write_file", file=file_path, error=str(e))
|
raise YunohostError("cannot_write_file", file=file_path, error=str(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue