diff --git a/data/helpers.d/config b/data/helpers.d/config index d12065220..7a2ccde46 100644 --- a/data/helpers.d/config +++ b/data/helpers.d/config @@ -123,7 +123,10 @@ _ynh_app_config_apply() { ynh_print_info --message="File '$bind_file' removed" else ynh_backup_if_checksum_is_different --file="$bind_file" - cp "${!short_setting}" "$bind_file" + if [[ "${!short_setting}" != "$bind_file" ]] + then + cp "${!short_setting}" "$bind_file" + fi ynh_store_file_checksum --file="$bind_file" --update_only ynh_print_info --message="File '$bind_file' overwrited with ${!short_setting}" fi diff --git a/src/yunohost/utils/config.py b/src/yunohost/utils/config.py index a84b4cafe..3fccd8cc5 100644 --- a/src/yunohost/utils/config.py +++ b/src/yunohost/utils/config.py @@ -927,11 +927,11 @@ class FileQuestion(Question): "content": self.value, "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): + if self.value is None: + self.value = self.current_value + super()._prevalidate() if ( isinstance(self.value, str) @@ -966,7 +966,7 @@ class FileQuestion(Question): if not 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_") FileQuestion.upload_dirs += [upload_dir]