Skip to content

Skip unusable attachments on remote posts - #3866

Merged
pfefferle merged 2 commits into
trunkfrom
fix/remote-attachment-parsing
Oct 19, 2026
Merged

pfefferle merged 2 commits into
trunkfrom
fix/remote-attachment-parsing

Conversation

@pfefferle

Copy link
Copy Markdown
Member

Split out of #3850.

Proposed changes:

  • Remote_Posts::extract_attachments() is now public and takes a result limit and an optional type, so Display images attached to Fediverse comments #3850 can reuse it for comments. It inspects at most 20 candidates (or the limit, if higher).
  • A single attachment or a bare URL is handled like a list, for attachment as well as for image.
  • Attachment URLs must be absolute HTTP(S) URLs with a host. Relative URLs, javascript: and similar are skipped. Host checks (private IPs, ports) stay where they are, in the media cache before the download, so there is no DNS lookup while saving and a failed lookup can't drop an image.
  • Attachments with a mediaType that is not image, audio or video (a PDF, for example) are now typed document and no longer added as an image. Before, they showed up as a broken image. Attachments without mediaType are treated like before: Audio and Video by their type, everything else as an image.
  • Descriptions keep characters like < instead of having them stripped. They are escaped when the image is built.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • Follow an account that posts images, audio or video and check that new posts show their media like before.
  • Run npm run env-test -- --filter 'Test_Remote_Posts|Test_Functions_Media'.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Skip unusable attachments on posts from other servers instead of showing them as broken images.

The entry is already part of the branch.

@pfefferle
pfefferle requested a review from jeherve October 19, 2026 14:54
@pfefferle
pfefferle merged commit aa65a64 into trunk Oct 19, 2026
11 checks passed
@pfefferle
pfefferle deleted the fix/remote-attachment-parsing branch October 19, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant