mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Small fixes about file questions in config panel
This commit is contained in:
parent
63d3ccd827
commit
4a1d6f2257
2 changed files with 8 additions and 5 deletions
|
@ -123,7 +123,10 @@ _ynh_app_config_apply() {
|
||||||
ynh_print_info --message="File '$bind_file' removed"
|
ynh_print_info --message="File '$bind_file' removed"
|
||||||
else
|
else
|
||||||
ynh_backup_if_checksum_is_different --file="$bind_file"
|
ynh_backup_if_checksum_is_different --file="$bind_file"
|
||||||
|
if [[ "${!short_setting}" != "$bind_file" ]]
|
||||||
|
then
|
||||||
cp "${!short_setting}" "$bind_file"
|
cp "${!short_setting}" "$bind_file"
|
||||||
|
fi
|
||||||
ynh_store_file_checksum --file="$bind_file" --update_only
|
ynh_store_file_checksum --file="$bind_file" --update_only
|
||||||
ynh_print_info --message="File '$bind_file' overwrited with ${!short_setting}"
|
ynh_print_info --message="File '$bind_file' overwrited with ${!short_setting}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -927,11 +927,11 @@ class FileQuestion(Question):
|
||||||
"content": self.value,
|
"content": self.value,
|
||||||
"filename": user_answers.get(f"{self.name}[name]", self.name),
|
"filename": user_answers.get(f"{self.name}[name]", self.name),
|
||||||
}
|
}
|
||||||
# If path file are the same
|
|
||||||
if self.value and str(self.value) == self.current_value:
|
|
||||||
self.value = None
|
|
||||||
|
|
||||||
def _prevalidate(self):
|
def _prevalidate(self):
|
||||||
|
if self.value is None:
|
||||||
|
self.value = self.current_value
|
||||||
|
|
||||||
super()._prevalidate()
|
super()._prevalidate()
|
||||||
if (
|
if (
|
||||||
isinstance(self.value, str)
|
isinstance(self.value, str)
|
||||||
|
@ -966,7 +966,7 @@ class FileQuestion(Question):
|
||||||
if not self.value:
|
if not self.value:
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
if Moulinette.interface.type == "api":
|
if Moulinette.interface.type == "api" and isinstance(self.value, dict):
|
||||||
|
|
||||||
upload_dir = tempfile.mkdtemp(prefix="tmp_configpanel_")
|
upload_dir = tempfile.mkdtemp(prefix="tmp_configpanel_")
|
||||||
FileQuestion.upload_dirs += [upload_dir]
|
FileQuestion.upload_dirs += [upload_dir]
|
||||||
|
|
Loading…
Add table
Reference in a new issue