You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YunoHost seems to misinterpret strings enclosed in brackets as arrays or lists when retrieving configuration settings (_ynh_app_config_get_one function). Specifically, when a config value like [prefix] is read from a configuration file (in my case it’s a simple file containing the prefix string), it's incorrectly formatted as [ "prefix"], suggesting an erroneous interpretation as a list or array instead of a simple string. I am currently working on a mailing list package, which includes a configuration panel option to modify the subject prefix. The use of brackets to encapsulate prefixes is a common convention, following standard mailing lists practice. For example, a typical mailing list subject might start with [ListName] to clearly indicate the source or category of the email.
Context
Hardware: KVM, virtual box etc.
YunoHost version: 11.2.8.2
Access to server: Through SSH and Webadmin
Special context or tweaks: No special context or tweaks applied
To Reproduce
Reproducing the issue involves either creating a YunoHost package with a string field in config_panel.toml and retrieving a text of the type [mytext] via a bind or a getter, or by directly invoking the relevant functions. The two methods are as follows:
Through Package Creation with config_panel.toml:
Create a YunoHost package or modify an existing one.
Use or add a string field in the config_panel.toml file.
Set up the package to retrieve a value like [mytext] either through a bind mechanism or a custom getter function. For instance in my case :
Observe how the system handles this string when it's read from the configuration.
Or more precisely look at the regular expression var_part
Expected Behavior
The expected behavior is for YunoHost to correctly interpret and display simple strings, even when they are enclosed in brackets. For example, a string [prefix] in the config file should be read and displayed as [prefix], not [ "prefix"].
Approaches for Solution
I have two potential solutions in mind :
Modifying Existing Scripts:
Adjust the _ynh_app_config_get_one and ynh_read_var_in_file functions to better handle simple strings, especially those enclosed in brackets. This might involve adding conditions to check if a string matches a simple pattern and then extracting it directly without using complex regular expressions.
Adding a Descripteur in config_panel.toml:
Implement a new descriptor (e.g., file=text) in config_panel.toml. This descriptor would inform _ynh_app_config_get_one about the type of content (simple text or complex structure), which would then pass this information to ynh_read_var_in_file to adjust the extraction logic accordingly.
Logs
Logs were not applicable at the moment of reporting. The issue is more about the potential improvement in the script logic than a specific error in the system.
The text was updated successfully, but these errors were encountered:
Describe the Bug
YunoHost seems to misinterpret strings enclosed in brackets as arrays or lists when retrieving configuration settings (_ynh_app_config_get_one function). Specifically, when a config value like
[prefix]
is read from a configuration file (in my case it’s a simple file containing the prefix string), it's incorrectly formatted as[ "prefix"]
, suggesting an erroneous interpretation as a list or array instead of a simple string. I am currently working on a mailing list package, which includes a configuration panel option to modify the subject prefix. The use of brackets to encapsulate prefixes is a common convention, following standard mailing lists practice. For example, a typical mailing list subject might start with [ListName] to clearly indicate the source or category of the email.Context
To Reproduce
Reproducing the issue involves either creating a YunoHost package with a string field in
config_panel.toml
and retrieving a text of the type[mytext]
via a bind or a getter, or by directly invoking the relevant functions. The two methods are as follows:Through Package Creation with
config_panel.toml
:config_panel.toml
file.[mytext]
either through a bind mechanism or a custom getter function. For instance in my case :By Directly Invoking Functions:
[mytext]
.Expected Behavior
The expected behavior is for YunoHost to correctly interpret and display simple strings, even when they are enclosed in brackets. For example, a string
[prefix]
in the config file should be read and displayed as[prefix]
, not[ "prefix"]
.Approaches for Solution
I have two potential solutions in mind :
Modifying Existing Scripts:
_ynh_app_config_get_one
andynh_read_var_in_file
functions to better handle simple strings, especially those enclosed in brackets. This might involve adding conditions to check if a string matches a simple pattern and then extracting it directly without using complex regular expressions.Adding a Descripteur in
config_panel.toml
:file=text
) inconfig_panel.toml
. This descriptor would inform_ynh_app_config_get_one
about the type of content (simple text or complex structure), which would then pass this information toynh_read_var_in_file
to adjust the extraction logic accordingly.Logs
Logs were not applicable at the moment of reporting. The issue is more about the potential improvement in the script logic than a specific error in the system.
The text was updated successfully, but these errors were encountered: