Skip to content

Image taxonomy gaps: .tif, .avif and .jfif are silently skipped #364

Description

@lstein

Surfaced by the adversarial review of #355, deliberately deferred so that PR could stay a strict no-behavior-change refactor.

IMAGE_EXTENSIONS (photomap/backend/media_types.py) contains .tiff but not .tif, and omits .avif and .jfif. The installed Pillow opens all three — verified: Pillow 12.2.0 with features.check('avif')True.

Impact

  • .tif is the dominant spelling from scanners, Photoshop and Windows tooling, and docs/user-guide/basic-usage.md:15 and docs/user-guide/albums.md:32 both promise TIFF support.
  • Point an album at 800 scan001.tif files and the walk skips every one before the dimension gate or the reject cache. Indexing reports zero images and the album is silently empty — no error, no warning, nothing in the log.
  • The same suffixes are also 403'd by the serving guard (routers/search.py:323 and :445), since SUPPORTED_EXTENSIONS is that same set.

Why it wasn't fixed in #355

Adding them widens the /images/ and /image_by_name/ allowlist, which is a genuine behavior change — and the whole point of #355 was that it changed nothing, so the diff could be reviewed as a pure rename. It also deserves its own tests rather than riding along with the video work.

Suggested fix

  • Add .tif, .avif, .jfif to IMAGE_EXTENSIONS
  • Update EXPECTED_IMAGE_EXTENSIONS in tests/backend/test_media_types.py (deliberately pinned to a literal so this cannot change silently)
  • Add a fixture image per new suffix and assert it indexes and serves
  • Confirm .avif support is present in the Pillow floor the project actually resolves, not just the locked one — it is conditional on the build

Worth checking .heif/.heic at the same time: they are in the set, but PIL can only open them because register_heif_opener() runs as an import-time side effect in embeddings.py:176. Any future caller importing media_types on its own — which is the entire point of that module being a leaf — gets is_image('x.heic') == True and then UnidentifiedImageError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions