mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
config: handle case where file quetion didnt get modified from webadmin, in which case self.value contains a path
This commit is contained in:
parent
df19488c87
commit
54d901ad78
1 changed files with 2 additions and 3 deletions
|
@ -1019,10 +1019,9 @@ class FileQuestion(Question):
|
||||||
FileQuestion.upload_dirs += [upload_dir]
|
FileQuestion.upload_dirs += [upload_dir]
|
||||||
|
|
||||||
logger.debug(f"Saving file {self.name} for file question into {file_path}")
|
logger.debug(f"Saving file {self.name} for file question into {file_path}")
|
||||||
if Moulinette.interface.type != "api":
|
if Moulinette.interface.type != "api" or (self.value.startswith("/") and os.path.exists(self.value)):
|
||||||
content = read_file(str(self.value), file_mode="rb")
|
content = read_file(str(self.value), file_mode="rb")
|
||||||
|
else:
|
||||||
if Moulinette.interface.type == "api":
|
|
||||||
content = b64decode(self.value)
|
content = b64decode(self.value)
|
||||||
|
|
||||||
write_to_file(file_path, content, file_mode="wb")
|
write_to_file(file_path, content, file_mode="wb")
|
||||||
|
|
Loading…
Add table
Reference in a new issue