pleroma/test/pleroma/web
moon.eth b11e8888d1 MediaProxy: improve inline rendering of remote image attachments
Two related changes that ensure remote images render inline in timelines
instead of as clickable links.

reverse_proxy: always force inline for whitelisted content types
  When `inline_content_types` is configured as a whitelist, the upstream's
  `content-disposition` header used to be passed through unchanged. Some
  origins send `content-disposition: attachment` for media we want
  embedded, so the proxy now always emits `content-disposition: inline`
  for whitelisted types (overriding the upstream header), deriving a
  filename from `MIME.extensions/1` (e.g. `inline.gif`) so browsers have
  something to use for "Save As". When the type has no known extension,
  the bare token `inline` is emitted. The `inline_content_types: true`
  (pass-through) and `:false` (always attachment) behaviours are
  unchanged.

ActivityPub: sniff MIME type for extensionless/generic attachments
  Some remotes (e.g. extensionless Cloudflare Images URLs) ship
  attachments with no usable `mediaType` (missing, empty, or
  `application/octet-stream`), which would render as links instead of
  inline images. `AttachmentValidator.fix_media_type/1` now fetches the
  first 8 KB of the URL and runs it through libmagic when the declared
  type carries no real information. Only `image/*` results replace the
  declared type; any other result, non-2xx response, transport error, or
  exception yields `nil` and the original type is kept, so ingestion
  never blocks and non-image media is never reclassified. Present real
  types are left untouched (no fetch is attempted).

The new logic lives in `Pleroma.Web.ActivityPub.ObjectValidators.AttachmentTypeSniffer`.

Tests: comprehensive coverage of both changes, including a dedicated
suite for the sniffer covering happy paths, non-image bodies, HTTP
failures, raised exceptions, guard clauses, and verification that the
Range header is sent; AttachmentValidator tests for mimeType fallback,
empty-string mediaType, multi-URL sniffing, and HTTP-failure fallback;
ReverseProxy tests for inline_content_types `true`/`false`/custom
whitelists, bare-inline for types without a MIME extension, and
attachment_name handling.
2026-07-14 15:04:06 +09:00
..
activity_pub MediaProxy: improve inline rendering of remote image attachments 2026-07-14 15:04:06 +09:00
admin_api Merge branch 'develop' into pleroma-database-config-whitelist 2026-03-01 22:44:08 +00:00
api_spec Add extraction process for oauth scopes 2023-05-02 16:32:10 -04:00
auth Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
common_api update tests 2026-03-06 18:10:07 +01:00
feed Redirect /users/:nickname.rss to /users/:nickname/feed.rss instead of .atom 2025-10-15 10:27:31 +02:00
mastodon_api Merge pull request 'Allow attaching emojis to user lists' (#7929) from mkljczk/pleroma:list-emoji into develop 2026-06-29 12:51:43 +00:00
media_proxy MediaProxyController: Use 301 for permanent redirects 2025-01-21 12:24:56 +04:00
metadata Fix OpenGraph/TwitterCard meta tag ordering for posts with multiple attachments 2025-02-28 13:36:00 -08:00
o_auth Don't use the confusing TwitterAPI namespace 2026-02-27 19:53:25 +01:00
o_status Fix order of args for favorite/2 2024-07-22 18:25:37 -04:00
pleroma_api Don't use the confusing TwitterAPI namespace 2026-02-27 19:53:25 +01:00
plugs Merge branch 'develop' into host-verification 2026-05-14 06:01:31 +00:00
preload/providers Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
push Fix order of args for follow/2 2024-07-22 19:07:55 -04:00
remote_interaction lint: fix warnings throughout codebase 2026-03-31 16:23:11 +02:00
rich_media Tighten rich media backfill stream test 2026-05-25 14:08:07 +04:00
static_fe Fix Phoenix upstream migration regressions 2026-05-11 22:14:01 +04:00
views Do not allow committing tests with a .ex extension 2024-08-07 13:07:54 -04:00
web_finger Add specific tests for Webfinger aliases / also_known_as 2025-07-03 11:19:52 -07:00
common_api_test.exs Use published Pleroma MFM parser package 2026-05-11 19:13:01 +04:00
fallback_test.exs Fix LiveDashboard redirect not working when user added a path segment 2026-02-17 21:10:56 +01:00
federator_test.exs Reachability refactor 2025-06-06 12:32:09 -07:00
gettext_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
manifest_controller_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
media_proxy_test.exs Add test for mangling incorrect URL in MediaProxy link generation 2025-12-10 14:56:06 +01:00
mongoose_im_controller_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
node_info_test.exs Grouped Notifications: Add feature flag to instance view and nodeinfo 2026-06-10 22:54:06 +02:00
registration_test.exs Don't use the confusing TwitterAPI namespace 2026-02-27 19:53:25 +01:00
rel_me_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
shout_channel_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
streamer_test.exs update tests 2026-03-06 18:10:07 +01:00
uploader_controller_test.exs Revert "Merge branch 'copyright-bump' into 'develop'" 2023-01-02 20:38:50 +00:00
web_finger_test.exs Tests: Syncify tests that mutate global state. 2026-01-07 17:59:37 +04:00
xml_test.exs Completely disable xml entity resolution 2023-08-05 14:17:04 +02:00