RichMedia: skip the quote fallback link when picking the card URL #8004
No reviewers
Labels
No labels
AP C2S
AdminAPI
Breaking API
Breaks existing config
Check if still valid
Data Protection
Do not merge
Document in the changelog
Doing
Feature Request / Enhancement
MastoAPI
NL2
NL4
OStatus
OTP Releases
Refactor
Security
To Do
TwitterAPI
bug
complicated
confirmed
deps
discussion
documentation
easy
feature: to be merged in stable
fix: to be merged in stable
incident
needs to be backported to maint
needs-changes
needs-info
needs-review
performance
regression
unclear
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
pleroma/pleroma!8004
Loading…
Reference in a new issue
No description provided.
Delete branch "lambadalambda/pleroma:fix/card-skip-quote-link"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Quote posts from Mastodon, Misskey and InlineQuotePolicy start with
RE: <url>in a.quote-inlineelement.HTML.extract_first_external_url_from_object/1took that link for the link card, so the quoted post showed twice (as quote and as card) and a real link later in the post got no card.Links inside
.quote-inlineand a link equal to the object'squoteUrlare now skipped. Tests for the Mastodon paragraph, the Misskey/InlineQuotePolicy span and a bare link to the quoted post./oc review
Review: quote fallback link skipped for link cards
No defects found. This change is narrow, well-tested, and safe to merge.
What the change does
lib/pleroma/html.ex:extract_first_external_url_from_object/1now drops the.quote-inlinesubtree viaFloki.filter_out/2before picking the first link, and skips any barehrefexactly equal to the object'squoteUrl, falling through to the next link instead of returning the quoted post's URL.test/pleroma/html_test.exs: covers the three shapes named in the PR body — Mastodon<p class="quote-inline">paragraph, Misskey/InlineQuotePolicy<span class="quote-inline">span, and a bareRE: <a>link equal toquoteUrl.changelog.d/card-skip-quote-link.fix: follows the existing<name>.fixfragment convention.Correctness checks
Floki.filter_out/2exists in the pinnedfloki 0.38.0and is already used the same way inanti_link_spam_policy.exandlanguage_detector.ex, so no new API risk..quote-inlinewrapper is machine-generated fallback markup (seeInlineQuotePolicy.build_inline_quote/2, which emits exactly the tested<span class="quote-inline">shape; Mastodon emits the<p>shape), not user content, so filtering the whole subtree cannot hide a genuine user link in practice.quoteUrlis absent,data["quoteUrl"]isniland nohrefequals it, so behavior is identical to the old take-first-link path for non-quote posts.nilandCard.get_by_object/1correctly produces no card instead of a self-referential one.Tests run
mix test test/pleroma/html_test.exs— 28 tests, 0 failures (includes the 3 new quote-link tests).mix test test/pleroma/web/rich_media/card_test.exs— 3 tests, 0 failures.Verdict
No findings. Merge-readiness: 5/5 — production-ready.
opencode-agent:job=169:generation=1