Skip to content

PhoenixKit 2.23.3: PDF and ICO uploads get their previews again

PhoenixKit 2.23.3 fixes media processing for two kinds of upload: PDFs on servers that have poppler installed, and .ico icons.

On a server with poppler, every uploaded PDF failed during processing and was given up after three attempts, before any preview was made. The page count, author and other details read from the PDF now go into the file’s metadata, and the job finishes. A title someone already gave the file in the media library is kept; the PDF’s own title does not replace it.

Icon files failed every variant, because the copy made for processing had no file extension and ImageMagick needs one to read ICO. The copy now keeps the original’s extension, but only for images, video, audio and PDF.

A server without pdftoppm, pdfinfo, ImageMagick or FFmpeg is now reported as not having the tool, instead of logging pdftoppm error: nil for each PDF.

Full release notes: PhoenixKit 2.23.3

2.23.3 · 15 September 2026

Added

  • mix package.clean deletes the phoenix_kit-*.tar tarballs that mix hex.build / mix hex.publish leave in the project root (64 of them, 199 MB, had piled up). It runs as the last mix prerelease step; run it by hand after a bare mix hex.publish. The .gitignore entry for them, a leftover phoenix_module_template-*.tar from the template repo, now names phoenix_kit-*.tar.

  • mix precommit now compiles the test tree via a new test.compile alias, run between deps.unlock --check-unused and quality.ci. No existing gate step ever compiled test/**/*_test.exs: format and credo only parse them, compile and dialyzer see elixirc_paths (which covers test/support, not the .exs test files), and ExUnit is the only thing that compiles those — so a test file that is valid syntax but fails to compile (a duplicate describe name, for example, which ExUnit rejects at defmodule time) passed every step and only surfaced on the next mix test. The alias compiles every test file with Kernel.ParallelCompiler.compile/1 in a MIX_ENV=test subprocess, deliberately without test_helper.exs: no ExUnit.start, no database probe, no migration, zero tests run, so it cannot go red from the environment — only from a genuine compile error in test/. mix test itself is still not part of precommit; see AGENTS.md “CI/CD”.

Fixed

  • Stored originals keep their extension when copied out for processing. Storage.retrieve_file/1 — and Manager.retrieve_file/2 without a :destination_path — wrote the temp copy as phoenix_kit_<random>, with no extension. ImageMagick identifies some formats by extension alone, ICO among them, so ProcessFileJob failed every variant of an .ico upload with identify: no decode delegate for this image format and the job was discarded, even where ImageMagick reads ICO. The temp copy now carries the stored original’s extension, as Manager.replicate_to_buckets/3 already did. AnnotationThumbnail reads its source through the same call (#817). Only a media extension (image, video, audio, PDF — Manager.temp_extension/1) is kept: the extension is the uploader’s filename, and it also selects the ImageMagick coders that have no magic bytes (MVG, MSL, TXT), which an extensionless copy never reached — a .mvg uploaded as image/png is stored as an image and would have been handed to identify as MVG.
  • A missing pdftoppm, pdfinfo, identify or ffmpeg is reported as not installed. System.cmd/3 raises ErlangError with :enoent in original and reason: nil; PdfProcessor and System.Dependencies checked reason, so the not-installed branch never ran — a host without poppler logged pdftoppm error: nil for every PDF, and check_imagemagick/0 / check_ffmpeg/0 returned {:error, "Error checking …: nil"} instead of {:error, :not_installed}.
  • PDF uploads are processed again on hosts that have poppler. ProcessFileJob merged pdfinfo’s string-keyed fields ("page_count", "author", …) into the atom-keyed %{status: "active"} update, and Ecto.Changeset.cast/3 rejects a mixed-key map — so every PDF job raised Ecto.CastError on the metadata step and was discarded after three attempts, before any preview variant was rendered. Without poppler extract_metadata/1 returns %{} and the merge happened to be clean, which is why the crash only showed up once the tool was installed. The fields now go into the file’s :metadata map (PdfProcessor.file_attrs/2) (#816), filling only keys it doesn’t already hold — "title" is also the user-editable title the media detail page saves there, and a re-processed PDF must not replace it with the document’s own Title.

PhoenixKit 2.23.3. Install or update: {:phoenix_kit, "~> 2.23"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.