[WEB-5791]fix: broken favicon in links
Description
This PR will fix the broken favicon in links.
Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
[!NOTE] Resolve favicon using the final redirected URL to prevent 404s and incorrect favicon_url values.
- Backend:
- Favicon resolution in
apps/api/plane/bgtasks/work_item_link_task.py:
- Track
final_urlfromrequests.get(...).urlafter redirects and use it infetch_and_encode_faviconfor correct favicon discovery.- Prevents incorrect
favicon_url(e.g., 404) when initial URL redirects.Written by Cursor Bugbot for commit ab958cddb632a55c4c91efcad41c8f700538e88c. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
- Bug Fixes
- Fixed favicon resolution to correctly handle URLs that redirect, ensuring favicons are retrieved from the final destination rather than the original URL.
βοΈ Tip: You can customize this high-level summary in your review settings.
[!NOTE]
Other AI code review bot(s) detected
CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.
π Walkthrough
Walkthrough
Adds is_ip_address(url) and uses a final_url variable to validate hosts before and after HTTP redirects; requests use final_url, redirects update final_url from response.url, and favicon retrieval/encoding operates on the redirected final_url; existing error handling retained.
Changes
| Cohort / File(s) | Summary |
|---|---|
Link fetching & validation apps/api/plane/bgtasks/work_item_link_task.py |
Add is_ip_address(url) to validate host/IP (reject private/loopback/reserved); create and update final_url from response.url to reflect redirects; validate final_url before/after request; perform GETs and favicon fetch using final_url; keep existing error handling and logging. |
Estimated code review effort
π― 2 (Simple) | β±οΈ ~8 minutes
π° I chased the redirects down the trail,
checked each burrow β no private mail,
fetched the tiny crest (favicon bright),
kept the headers polite through the night,
a hop, a sniff, and everythingβs right.
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | β Passed | The title clearly identifies the fix: improving favicon handling in links. It directly relates to the main change in the changeset. |
| Description check | β Passed | The PR description includes a brief description of changes, identifies the bug fix type, and provides implementation details via the Cursor summary. However, it lacks explicit completion of several template sections. |
β¨ Finishing touches
- [ ] π Generate docstrings
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
fix-work-item-link-favicon
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.