fix: coerce null _id to empty string in revoke fingerprint match (v0.1.7)
a key doc with an explicit `_id: null` made doc.get("_id", "") return None
instead of the default, so .startswith(prefix) raised an uncaught
AttributeError instead of the contracted clean [✘] + exit 1.
Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = "0.1.6"
|
||||
__version__ = "0.1.7"
|
||||
|
||||
@@ -23,7 +23,7 @@ def _find_by_fingerprint(storage, prefix: str):
|
||||
"""
|
||||
if not prefix:
|
||||
raise CommandError("fingerprint prefix must not be empty")
|
||||
matches = [doc for doc in storage.get_all() if doc.get("_id", "").startswith(prefix)]
|
||||
matches = [doc for doc in storage.get_all() if (doc.get("_id") or "").startswith(prefix)]
|
||||
if len(matches) > 1:
|
||||
ids = ", ".join(d["_id"][:16] for d in matches)
|
||||
raise CommandError(f"fingerprint prefix '{prefix}' is ambiguous; matches: {ids}")
|
||||
|
||||
Reference in New Issue
Block a user