fix: use Zotero-valid charset in key generator (no 0, 1, O, L)
Some checks failed
CI / lint-test (push) Failing after 1m22s
CI / skinny-install (bib) (push) Successful in 31s
CI / skinny-install (bls) (push) Successful in 21s
CI / skinny-install (ccw) (push) Successful in 38s
CI / skinny-install (cli) (push) Successful in 27s
CI / skinny-install (cms) (push) Successful in 30s
CI / skinny-install (conf) (push) Successful in 25s
CI / skinny-install (opps) (push) Successful in 23s
CI / skinny-install (perf) (push) Successful in 31s
CI / skinny-install (bcda) (push) Successful in 35s
CI / skinny-install (rex) (push) Failing after 7h40m2s
CI / skinny-install (pfs) (push) Failing after 7h40m17s
Infra CI / notebooks (push) Successful in 5s
Infra CI / zotero (push) Successful in 7s
Infra CI / docs (push) Failing after 9s
Infra CI / api (push) Successful in 8s
Infra CI / mc (push) Successful in 6s
Deploy / build-scan-report (push) Failing after 1m44s
Package Supply Chain / pkg-supply-chain (push) Successful in 56s
Harden / build-scan-report (push) Failing after 9m29s
CI / skinny-install (aco) (push) Successful in 47s
CI / skinny-install (api) (push) Successful in 29s

_generate_key() used string.ascii_uppercase + string.digits which
includes 0, 1, O, L — all invalid in Zotero's key charset. This
caused newly created items to fail Zotero sync and pincite regex
matching.

Root cause of the rekeying needed for 10,236 items.
This commit is contained in:
kert
2026-03-27 01:32:32 -04:00
parent e5124513fb
commit 2cadc8678a

View File

@@ -21,7 +21,6 @@ import mimetypes
import random import random
import shutil import shutil
import sqlite3 import sqlite3
import string
from importlib import resources from importlib import resources
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
@@ -30,8 +29,8 @@ from bib.item import Item
def _generate_key() -> str: def _generate_key() -> str:
"""8-char alphanumeric key.""" """8-char key using Zotero-compatible charset (no 0, 1, O, L)."""
chars = string.ascii_uppercase + string.digits chars = "23456789ABCDEFGHIJKLMNPQRSTUVWXYZ"
return "".join(random.choices(chars, k=8)) # noqa: S311 return "".join(random.choices(chars, k=8)) # noqa: S311