Use shlex.quote for quoting shell arguments#1470
Use shlex.quote for quoting shell arguments#1470davidism merged 1 commit intopallets:7.xfrom jwodder:shlex-quote
Conversation
|
Thanks for starting this! This is sort of papering over a bigger design issue, which is the use of |
|
@davidism Yes, I can do that. I just have a couple questions about the intentions of some
|
Yes, I agree it seems overly complex to just check if it exists. Since there's no comments about why that was used, and simpler commands seem to accomplish the same thing, I don't mind replacing it. I don't want to copy the
The I opened #1476 for replacing |
|
I'm going to merge this in to 7.1, but it should eventually be replaced with #1477. I added |
|
We are experiencing the same regression as @dufferzafar although in our case it is maybe a bit because we were abusing the liberty of the interface. For unit testing of interactive components of our CLI that require the user to make changes in a visual editor, we would actually set the I realize that our approach is a bit hacky: do you have an alternate idea on how to unit test interactive commands that go through an editor? |
|
Click 7.1.2 is available on PyPI. |
There are several points in the code in which filenames used as arguments in shell commands (executed with either
os.system()orsubprocess.Popen(shell=True)) are quoted by just enclosing them in double quotes. This will fail whenever the filenames happen to already contain double quotes. This patch fixes this behavior by quoting the filenames withshlex.quote()instead (pipes.quote()in Python 2).fixes #1026