SortBySpec: avoid triggering bandit security checker

Guess it was triggered due to naming the variable "token",
maybe "sort_key" is less problematic.
This commit is contained in:
Thomas Waldmann 2026-02-25 12:10:40 +01:00
parent 9a469e32cf
commit 27561bd9cc
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -351,9 +351,9 @@ def FilesystemPathSpec(text):
def SortBySpec(text):
from ..manifest import AI_HUMAN_SORT_KEYS
for token in text.split(","):
if token not in AI_HUMAN_SORT_KEYS and token != "ts": # idempotency: do not reject ts
raise argparse.ArgumentTypeError("Invalid sort key: %s" % token)
for sort_key in text.split(","):
if sort_key not in AI_HUMAN_SORT_KEYS and sort_key != "ts": # idempotency: do not reject ts
raise argparse.ArgumentTypeError("Invalid sort key: %s" % sort_key)
return text.replace("timestamp", "ts").replace("archive", "name")