pleroma/test/pleroma
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/ir Tests: Remove async from cases that use Mock 2023-12-10 17:10:18 +04:00
chat
config Fix test "transforms config to tuples" 2023-12-29 22:50:26 -05:00
conversation api: ensure only visible posts are interactable 2025-12-11 23:30:02 +01:00
docs
ecto_type/activity_pub/object_validators Fix good_locale_code?/1 regex 2024-07-28 13:44:17 +02:00
emails Revert "Tests: fix more tests" 2023-12-12 19:35:08 +04:00
emoji Reset Emoji cache between tests 2025-07-22 15:21:20 -07:00
gun Gun Connection Pool: successfully retry after reclaiming the pool 2024-06-20 14:03:22 -04:00
http typo 2026-02-22 10:05:50 +00:00
instances Rename Instance.delete_users_and_activities/1 to Instance.delete/1 2025-06-28 13:37:06 -07:00
integration Fix WebSocket protocol token handshakes 2026-05-22 16:30:14 +04:00
language Support translateLocally translation provider 2025-10-15 11:00:37 +02:00
mfa Implement a custom uri_equal?/2 to fix comparisons of URLs with unordered query parameters 2023-12-29 22:50:26 -05:00
migration_helper Fix order of args for favorite/2 2024-07-22 18:25:37 -04:00
object Reachability refactor 2025-06-06 12:32:09 -07:00
password
repo/migrations Tests: Syncify tests that mutate global state. 2026-01-07 17:59:37 +04:00
search Merge remote-tracking branch 'origin/develop' into gitlab-mr-iid-4161 2026-03-25 13:31:07 -07:00
upload StripLocation, ReadDescription: Silence noisy errors. 2026-01-08 13:40:25 +04:00
uploaders IPFS uploader: dialyzer fixes 2024-05-30 15:14:27 -04:00
user Search: Better sorting for user searches. 2026-01-01 10:02:37 +04:00
web MediaProxy: improve inline rendering of remote image attachments 2026-07-14 15:04:06 +09:00
workers lint 2026-05-13 00:44:33 +02:00
activity_test.exs Tests AP Factory: fix featured collection factories 2025-12-25 20:40:12 +01:00
announcement_read_relationship_test.exs
announcement_test.exs
application_requirements_test.exs Revert "Tests: fix more tests" 2023-12-12 19:35:08 +04:00
bookmark_folder_test.exs Allow to group bookmarks in folders 2024-03-01 11:04:01 +01:00
bookmark_test.exs Allow to group bookmarks in folders 2024-03-01 11:04:01 +01:00
captcha_test.exs
chat_test.exs
config_db_test.exs Merge pull request 'Harden rate limiter to deal with configuration issues' (#7795) from gitlab-mr-iid-4418 into develop 2026-03-25 19:55:08 +00:00
config_test.exs
conversation_test.exs api: ensure only visible posts are interactable 2025-12-11 23:30:02 +01:00
dependency_version_test.exs Update majic to 1.2.0 2026-05-13 18:39:40 +04:00
emoji_test.exs Credo.Check.Readability.PredicateFunctionNames 2024-01-26 16:59:58 -05:00
filter_test.exs
following_relationship_test.exs
formatter_test.exs Fix some more typos 2023-12-28 00:17:04 +01:00
frontend_test.exs File.mkdir_p -> Pleroma.Backports.mkdir_p 2025-06-16 12:48:47 +02:00
hashtag_test.exs Strip hashtag prefixes 2025-07-31 18:17:59 -07:00
healthcheck_test.exs Fix tests by leveraging Keyword.equal?/2 2023-12-29 22:50:26 -05:00
html_test.exs Add tests for Mastodon mention hashtag class 2024-09-06 11:51:16 -04:00
http_test.exs Tests: Syncify tests that mutate global state. 2026-01-07 17:59:37 +04:00
instances_test.exs Add Instances.delete_all_unreachable/0 2025-06-28 13:23:37 -07:00
job_queue_monitor_test.exs Switch formatting checks to Elixir 1.15 2024-06-12 15:18:47 -04:00
keys_test.exs
list_test.exs Allow attaching emojis to user lists 2026-06-23 16:08:52 +02:00
maps_test.exs Maps: Add filter_empty_values/1 2024-01-26 16:18:29 +01:00
marker_test.exs Elixir 1.19: Fix typing violation in MarkerTest 2026-03-25 11:10:48 -07:00
mfa_test.exs
moderation_log_test.exs Fix ModerationLog FunctionClauseError for unknown actions 2025-08-01 10:39:39 -07:00
notification_test.exs fix typo 2025-11-28 14:53:22 +01:00
object_test.exs File.mkdir_p -> Pleroma.Backports.mkdir_p 2025-06-16 12:48:47 +02:00
pagination_test.exs
pleroma_ctl_test.exs Woodpecker CI: Publish update-compatible OTP releases 2026-05-02 11:57:04 +04:00
registration_test.exs
release_task_test.exs Linting 2024-11-21 16:32:05 +04:00
repo_test.exs Elixir 1.19: Fix typing violation in RepoTest 2026-03-25 11:10:43 -07:00
report_note_test.exs
resilience_test.exs Fix order of args for favorite/2 2024-07-22 18:25:37 -04:00
reverse_proxy_test.exs MediaProxy: improve inline rendering of remote image attachments 2026-07-14 15:04:06 +09:00
rule_test.exs
runtime_test.exs
safe_jsonb_set_test.exs
safe_zip_test.exs File.mkdir_p -> Pleroma.Backports.mkdir_p 2025-06-16 12:48:47 +02:00
scheduled_activity_test.exs Fix Oban related tests 2024-05-27 13:48:24 -04:00
schema_test.exs Test for missing FK indexes 2024-05-30 10:49:45 -04:00
search_test.exs Fix CommonAPI.favorite/2 arg order 2026-03-25 13:32:25 -07:00
signature_test.exs Signature: Treat HTTP signature errors as invalid 2026-05-12 08:52:42 +04:00
stats_test.exs Fix order of args for follow/2 2024-07-22 19:07:55 -04:00
upload_test.exs URI.encode_query needs an enum, add test for this case 2025-12-10 14:56:04 +01:00
user_invite_token_test.exs
user_relationship_test.exs UserRelationshipTest: Don't use Mock. 2025-02-23 17:51:25 +04:00
user_search_test.exs Allow filtering users with accepts_chat_messages capability 2025-10-10 05:24:13 +02:00
user_test.exs Validate WebFinger nicknames against actors 2026-05-03 18:02:59 +04:00
utils_test.exs
xml_builder_test.exs