Skip to content

[fix] String started with at was interpreted as option#380

Open
zamentur wants to merge 5 commits into
devfrom
fix-2557-string-started-with-at
Open

[fix] String started with at was interpreted as option#380
zamentur wants to merge 5 commits into
devfrom
fix-2557-string-started-with-at

Conversation

@zamentur

Copy link
Copy Markdown
Member

The problem

Text related to an API option and starting with an at are interpreted as options and not as values !

Related issues: YunoHost/issues#2557

The solution

It's an argparse bug python/cpython#138950

Some comments suggest to use the equal notation but it doesn't work for positional arguments...

SO i found a dirty workaround cause no easy way to escape the value exists (doesn't really make sens in the usual context of argparse i guess...). I add a space at the beggining of the string and remove it just at the end of the wrapper function.

AI transparency: no AI used

PR Status

Tested manually

Code TODOs

seems ready

Tests TODOs

Indicate here tests you have already done, and tests you think should be done

  • Call the code through webadmin call by hand and use a logger.warning to get the value of the return
  • Change a user password starting with @ and log with it
  • Test to upload a file
  • Test an option allowing several values as a list

How to test

Comment thread moulinette/interfaces/api.py Outdated
Co-authored-by: tituspijean <tituspijean@yunohost.org>
Comment thread moulinette/interfaces/api.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants