Repository navigation
feat(linkcheck): replace a link that moved by its new address in the texts - #2834
Merged
Merged
Conversation
…texts
POST /documents/external-links/replace {url, new_url} (moderators): for a
link redirected (moved, ok after http -> https..., or another site reviewed
genuine), the link is fetched again first and replaced only when still
redirected permanently (301/308 at every step) to new_url, a page that
answers (not a home or login page). Each collaborative document linking it
gets a new version by the moderator; a text whose address is written
otherwise (escaped...) is left as it was and listed in the answer. The new
address is recorded as checked, so the link keeps its credit.
The list says which links are replaceable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
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. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 73 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Topic 2 of the moderation of the external links: a moderator replaces a link that moved by the address it leads to now, in every text.
API
POST /documents/external-links/replace{url, new_url}(moderators), for a link the list says replaceable: moved, ok with a final URL (http → https…), or redirected to another site and reviewed genuine.Before anything is written, the link is fetched again: it is replaced only if it is still redirected permanently (301 or 308 at every step) to
new_url, a page that answers, and not a home or login page. A temporary redirection (302, 303, 307) is refused, as an address that may change again.Then each collaborative document linking it gets a new version by the moderator. A text that writes the address otherwise (escaped…) is left as it is and listed in the answer, to change by hand. The new address is recorded as checked, so the link keeps its credit (
rel).GET /documents/external-links:replaceableon each link.Tests
tests/linkcheck/test_replace.py,tests/views/test_external_links_replace.py(11): permanent vs temporary redirections, a page gone or sent home, versions and texts, escaped addresses left, moderators only; contract tests + route inventory.Locally the linkcheck, external links, markdown and contract tests pass (541 + 11). In a full run with 4 workers some search tests failed on Elasticsearch timeouts;
test_waypoint.pyandtest_xreport.pypass on their own, on master and on this branch alike.UI: c2corg/c2c_ui PR to follow, after this one is deployed.
🤖 Generated with Claude Code