Compare commits

...

5 Commits

Author SHA1 Message Date
Bently
74d611e09a Format 2025-09-05 07:26:37 +01:00
Bently
e085ed2b6c Merge branch 'dev' into seer/fix-github-pr-url-validation 2025-09-05 07:15:21 +01:00
Bently
6867cd0d34 Delete test_fix.py 2025-09-05 07:15:06 +01:00
Nicholas Tindle
903066d0eb Merge branch 'dev' into seer/fix-github-pr-url-validation 2025-08-13 10:29:27 -05:00
seer-by-sentry[bot]
603b3986bf fix(backend): Improve GitHub PR URL validation and API URL generation 2025-07-07 16:08:02 +00:00

View File

@@ -553,11 +553,12 @@ class GithubListPRReviewersBlock(Block):
def prepare_pr_api_url(pr_url: str, path: str) -> str:
# Pattern to capture the base repository URL and the pull request number
pattern = r"^(?:https?://)?([^/]+/[^/]+/[^/]+)/pull/(\d+)"
pattern = r"^(?:https?://)?github\.com/([^/]+/[^/]+)/pull/(\d+)"
match = re.match(pattern, pr_url)
if not match:
return pr_url
raise ValueError(
f"Invalid GitHub PR URL: {pr_url}. URL must be a valid pull request URL, e.g., https://github.com/owner/repo/pull/123"
)
base_url, pr_number = match.groups()
return f"{base_url}/pulls/{pr_number}/{path}"
repo_path, pr_number = match.groups()
return f"{repo_path}/pulls/{pr_number}/{path}"