Thumbnail URLs are not HTML-entity decoded, so custom_thumbnail fails #117
Labels
No labels
bug
devops
duplicate
enhancement
good first issue
layout
next major release
next minor release
question
research
testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lvl0/fedi-feed-router#117
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Summary
Published posts have no thumbnail. The thumbnail is extracted and is passed to Lemmy, but the URL contains raw HTML entities (
&instead of&), so it is malformed by the time it reachescustom_thumbnail.Found while verifying the Belga fix (#115) — a Belga article published successfully, but without its image.
Root cause
extractThumbnail()returns the regex capture verbatim, with no entity decoding:Verified against a live Belga article page (
/press-releases/35285/):That
&should be&. The URL as returned does not resolve.The inconsistency
The same files do decode entities for other fields. In
BelgaArticlePageParser:extractTitle()→html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8')extractDescription()→html_entity_decode(...)extractThumbnail()→ no decodingSo this looks like an oversight rather than a deliberate choice.
Affects all three parsers
Identical un-decoded
return $matches[1];in:app/Services/Parsers/BelgaArticlePageParser.php:108-119app/Services/Parsers/VrtArticlePageParser.php:67-75app/Services/Parsers/GuardianArticlePageParser.php:70It only bites when the image URL contains query parameters (hence
&). Belga's CDN URLs always do, which is why it surfaced there first. VRT and Guardian may be silently affected depending on their image hosts.The plumbing is otherwise fine
No new wiring needed — the path already exists end to end:
*ArticlePageParser::extractData()returns athumbnailkeyLemmyPublisher.php:65passes$extractedData['thumbnail'] ?? nullLemmyApiService::createPost()sets$postData['custom_thumbnail'] = $thumbnailOnly the decoding is missing.
Note on
Article::image_urlSeparately, all six Belga articles currently have
image_url = NULLin the database even though extraction succeeds at publish time. Worth checking during implementation whetherimage_urlis ever populated from the extracted thumbnail, or whether the thumbnail is only ever read transiently during publishing. If the column is meant to be populated, that is a second gap — flagging rather than assuming, since it may be intentional.Acceptance criteria
extractThumbnail()decodes HTML entities in all three parsersog:imageURL containing&, asserting the decoded formArticle::image_urlshould be populatedRelated