8000 [VT-119] Improve handling of quotes in task titles · Issue #140 · vit-project/vit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[VT-119] Improve handling of quotes in task titles #140

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.

8000 Already on GitHub? Sign in to your account

Closed
taskwarrior opened this issue Feb 12, 2018 · 6 comments
Closed

[VT-119] Improve handling of quotes in task titles #140

taskwarrior opened this issue Feb 12, 2018 · 6 comments
Milestone

Comments

@taskwarrior
Copy link
Collaborator

Larry Hynes on 2015-04-17T21:07:04Z says:

I've been in touch with Scott about this via email and he felt that we might have a broader discussion here regarding vit's handling of quotes in task titles.

It seems that vit used to quote the entire title string, but that was removed to address [#114 | https://bug.tasktools.org/browse/VT-114] and [#111 | https://bug.tasktools.org/browse/VT-111].

I'm not sure what the best way to handle this is. As it stands I would be happy with a better error message, or better handling of the error message, but long-term I do think it would be great if vit could handle these cases without throwing an error.

@taskwarrior taskwarrior added this to the Backlog milestone Feb 12, 2018
@taskwarrior
Copy link
Collaborator Author

Migrated metadata:

Created: 2015-04-17T21:07:04Z
Modified: 2015-04-26T16:56:59Z

@taskwarrior
Copy link
Collaborator Author

Scott Kostyshak on 2015-04-22T17:25:12Z says:

Thanks for writing this up Larry. My idea is to have a .vitrc variable that contains the characters that the user wants to be escapted. For example, you could put a quote in there.

@taskwarrior
Copy link
Collaborator Author

Larry Hynes on 2015-04-26T16:56:59Z says:

That's a novel solution. I can see myself using it, and maybe putting '!' in there along with quotes. :)

@pekcheey
Copy link

I am wont to using single quote.. so as a workaround, before the proper solution comes to pass, the following seems to work.

cy@raspberrypi ~/s/vit> git diff vit/util.py
diff --git a/vit/util.py b/vit/util.py
index 02a824b..c6188f2 100644
--- a/vit/util.py
+++ b/vit/util.py
@@ -13,7 +13,7 @@ def clear_screen():

 def string_to_args(string):
     try:
-      return shlex.split(string)
+      return shlex.split(string.replace("'", "\\'").replace('"','\\"'))
     except ValueError:
       return []

cy@raspberrypi ~/s/vit>

@awilkins
Copy link
awilkins commented Jun 2, 2023

Sorry to necro this, but should this kind of escaping apply in other places?

e.g. using a quote in an Annotation without shell-escaping it means the annotation will not work.

@thehunmonkgroup
Copy link
Member

I'd need a test case to reproduce an actual problem, preferably using https://github.com/vit-project/vit/blob/2.x/scripts/generate-dummy-install.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0