fix: validate parsed PR URLs before extraction#577
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a907e01daa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| function normalizePrUrl(candidate: string): string | null { | ||
| const trimmed = candidate.trim().replace(/^[<`'"\[(]+|[>`'"\]),.?!;:]+$/g, ''); | ||
| const match = trimmed.match( | ||
| /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/pull\/(\d+)(?:[/?#].*)?$/ |
There was a problem hiding this comment.
Parse GitHub host case-insensitively in PR URL normalization
normalizePrUrl currently accepts only lowercase https://github.com/..., so valid URLs like https://GitHub.com/org/repo/pull/123 are rejected and extractPrUrl can report no PR URL (or fall back to an unrelated one). Because hostnames are case-insensitive and the prior logic accepted these marker URLs, this introduces a regression in PR detection for some assistant/tool outputs.
Useful? React with 👍 / 👎.
Summary