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

tags should be wrapped in double quotes in queries for tags with spaces #29

Open
digitalsignalperson opened this issue Jun 9, 2023 · 1 comment

Comments

@digitalsignalperson
Copy link

hey I'm using lieer which syncs tags to gmail labels so I'll have tags that looks like this "the tag/with stuff"

In dodo it lists all the tags but says there are zero messages for them.

Investigating a bit with notmuch, the following notmuch commands return nothing:

notmuch search tag:the tag/with stuff
notmuch search tag:"the tag/with stuff"

But the following does work:

notmuch search 'tag:"the tag/with stuff"'

I found that working combo here https://notmuchmail.org/pipermail/notmuch/2012/013532.html

so checking some of the calls dodo makes

stuff like this

r1 = subprocess.run(['notmuch', 'count', '--output=threads', '--', 'tag:'+t],

I think should be like

r1 = subprocess.run(['notmuch', 'count', '--output=threads', '--',  'tag:"%s"' % t],

just wrapping the tag in double quote (I think the extra single quotes are only needed in a shell)

I'll see if I can try fixing it

@digitalsignalperson
Copy link
Author

digitalsignalperson commented Jun 9, 2023

oh darn, this breaks this concept of

A tag expression is a string consisting of one more statements of the form "+TAG"
or "-TAG" to add or remove TAG, respectively, separated by whitespace

But it's valid for tags themselves to have whitespace

Looking at how this is used, we could just switch to a list instead of string

e.g.
stuff like

  'a':       ('tag -inbox -unread', lambda p: p.tag_thread('-inbox -unread')),

can be

  'a':       ('tag -inbox -unread', lambda p: p.tag_thread(["-inbox", "-unread"])),

so then later there's no need to tag_expr.split() and break any tags containing spaces.

Hmm, there's probably some other bugs too if anyone has a tag containing "+" or "-". I know sometimes (in general) I put in the first character of a tag or label things like "!", "#", "-", "+" etc. to make those appear at the top of various sorted lists in a UI.

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

No branches or pull requests

1 participant