mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +00:00
fix(job_key): keep the bare basis for an empty title whose URL has no six-digit run (#523)
The mixed-script rule from #514 appended the digest to `basis` as well, so an empty title with a URL that carries no six-digit run moved from "acme_https-example-com-jobs-abc-xyz" to "..._5ca8c6". Unreachable from /scrape, which always passes a title, but a key is a pure function of the posting and should not move for a case the rule was never about. A lossy fragment still takes the digest; an empty title keeps the bare basis or "untitled-<hash>" exactly as before #514. One new case pins the pre-#514 output and fails on current master. The CHANGELOG example for the Python-разработчик key is corrected to its real digest (python-fb29d7). Follow-up suggested in the #514 merge note.
This commit is contained in:
1 parent
760bbc34cf
commit
da2aee7bf1
3 files changed
+23
-3
No files matched your search
+4
-1
@@ -146,7 +146,10 @@ def make_key(company: str, title: str, url: str = "") -> str:
|
||||
# is left to key on.
|
||||
digest_basis = str(url) if url else str(title)
|
||||
digest = hashlib.sha1(digest_basis.encode("utf-8")).hexdigest()[:HASH_LEN]
|
||||
title_slug = f"{fragment or basis or 'untitled'}-{digest}"
|
||||
# A lossy fragment needs the digest to tell two postings apart; an
|
||||
# empty title keeps the bare basis (a URL-derived slug, or
|
||||
# "untitled-<hash>") exactly as before the fragment rule existed.
|
||||
title_slug = f"{fragment}-{digest}" if fragment else (basis or f"untitled-{digest}")
|
||||
return f"{company_slug}_{title_slug}"
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user