fix: repair broken redirect retry counter in link preview#2463
Conversation
`retries` was declared as `const` and the increment expression `retries + 1` was a no-op (evaluates and discards). This meant the redirect handler could never hit the `retries >= maxRetry` guard, allowing unbounded same-host redirects. Changed `const` to `let` and `retries + 1` to `retries += 1`.
|
Thanks for opening this pull request and contributing to the project! The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch. In the meantime, anyone in the community is encouraged to test this pull request and provide feedback. ✅ How to confirm it worksIf you’ve tested this PR, please comment below with: This helps us speed up the review and merge process. 📦 To test this PR locally:If you encounter any issues or have feedback, feel free to comment as well. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA bug fix in link preview redirect handling that changes the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This PR is stale because it has been open for 14 days with no activity. Remove the stale label or comment or this will be closed in 14 days |
…kets#2463) (cherry picked from commit bae7ead)
Summary
retrieswas declared asconst, so it could never be incrementedretries + 1was a no-op (evaluates and discards the result instead of assigning)retries >= maxRetryguard inhandleRedirectscould never trigger, allowing unbounded same-host redirectsFix
const retries = 0→let retries = 0retries + 1→retries += 1Test plan
maxRetry)Summary by CodeRabbit