fix(pr-review): case-insensitive _belongs slug compare (#875)
All checks were successful
ci/woodpecker/push/publish Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful

Closes #875

Mos (id-11) Gate-16 merge: independent APPROVE @9d8d58ae, author id2 != approver id11, clean mosaic-coder commit-author, CI green wp1982.

Co-authored-by: jason.woltje <jason@diversecanvas.com>
Co-committed-by: jason.woltje <jason@diversecanvas.com>
This commit was merged in pull request #877.
This commit is contained in:
2026-07-23 17:53:26 +00:00
committed by Mos
parent 7edc9b3121
commit 8504216964
2 changed files with 29 additions and 1 deletions

View File

@@ -203,7 +203,15 @@ try:
if not url:
return False
origin, path = _origin_and_path(url)
return origin == base_origin and path == expected_path
# Repo owner/repo slugs are case-insensitive (Gitea canonicalizes the
# pull_request_url slug to lowercase on return), while EXPECTED_REPO_SLUG
# is taken verbatim from GITEA_API_BASE and may be mixed-case. The
# remainder of the path (".../pulls/<number>") is numeric, so lowercasing
# the whole path for this comparison only relaxes case, not identity: the
# origin tuple (scheme+host+port) above still pins the provider host, and
# the path is still compared in FULL (no endswith/suffix match), so the
# look-alike-host and same-host decoy-prefix protections are unchanged.
return origin == base_origin and path.lower() == expected_path.lower()
if comment.get("id") != expected_id:
raise ValueError("read-back id does not match the created id")