Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert bool-like string arguments to actual bool #169

Closed
wants to merge 1 commit into from

Conversation

alexAubin
Copy link
Member

The problem

I need to be able to send a boolean argument 'force':True (equivalent to --force) from the webadmin in the context of a POST request.

However, turns out that transmitting booleans in POST data is not 100% trivial since only strings are transmitted anyway. So far we did not need such a thing...

Proposed solution

I could do some dirty hack in my command API but that wouldnt be pretty for CLI users ... So instead I propose this fix were, if an arg looks like a boolean (i.e. "true" or "false") it is converted to True/False

@zamentur
Copy link
Member

zamentur commented Sep 3, 2018

If someone try to put false or true as a password, i think it will display a warning and put password as password ...
https://github.com/YunoHost/moulinette/blob/stretch-unstable/moulinette/actionsmap.py#L114

@zamentur
Copy link
Member

@alexAubin What about this one ?

@alexAubin
Copy link
Member Author

Meh, i dunno, YunoHost/yunohost-admin#209 is in standby while we progress on other things so we'll see... But to me the edge case of "someone putting 'true' in a password field" doesnt convice me :/

(But agreed that my current PR is a bit dirty and hackish)

@alexAubin
Copy link
Member Author

Hmokay let's forget about this 😅 I must have missed something but it seems possible to pass booleans during GET requests and DELETE requests so must be possible somehow to do it in a POST request...

Will reopen if needed

@alexAubin alexAubin closed this Dec 20, 2018
@alexAubin alexAubin deleted the convert-string-to-bool branch December 20, 2018 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants