Skip to content

Restrict UID search query to prefixes, matching displayed ones #327

Description

@pacien

Description of the issue:

khard list displays unique prefixes of the UID field,
which is sufficient and convenient to uniquely identify a contact.

However, the search query uid:xxx returns all contacts having "xxx" as a
substring of their UID, not just a prefix.

This makes the displayed UID prefix useless as a unique identifier for
selecting contacts for viewing or editing.

Minimal problematic case:

Consider an address book with two contacts:

  • one with "UID: aaabbbb", and
  • one with "UID: bbbaaaa".

khard list correctly displays:

  • the first with short Uid prefix a, and
  • the second with short Uid prefix b.

But khard edit uid:a matches both instead of only the first,
because "a" is a substring of both UIDs!

Workaround:

The full UID can be displayed with --parsable,
which makes it usable in scripts but is bad for humans.

Related issue:

Going further:

I think that working unique short UID prefixes could completely replace the
Index column. Those numeric indexes have the issue of being tied to a
particular context, therefore ephemeral and confusing, while not necessarily
shorter than UID prefixes.

Version info:

  • Khard version 0.18.0
  • Python 3.10.12
  • NixOS 23.05

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakinginvolves breaking changes of some kindhelp wantedinterfacechanges the user interface in a non trivial way

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions