Read EXIF with a parser somebody maintains - #442
Merged
Merged
Conversation
`exifr` was last published in 2022. It is the one thing in the image that opens a file somebody else wrote using code nobody maintains any more, and it is loaded lazily in the metadata route precisely because nobody was sure of it. `exif-reader` replaces it: maintained alongside sharp, and it does nothing but walk a TIFF-shaped block with a bounds check on every read. The block itself needs no file access — sharp already opens the image to report its dimensions and hands the raw EXIF block back with them — so a photograph's details now come from one pass instead of two, and `exifr` leaves the dependencies. `utils/exifDetails.js` holds what the block is read for: when the picture was taken, the camera and lens, the exposure, the orientation, the place. Written as its own file because the metadata route is about what kind of thing a file is, and this is about what a photograph says of itself. ## Checks `exif-details.test.js`, 20 tests over the reading itself — a block that is not EXIF, a truncated one, dates in the three shapes cameras write them, a rational that divides by zero, coordinates in both hemispheres. Making the reader answer nothing turns six of them red. `metadata.test.js`, 13 tests through the route. Whole backend suite: 2 509 passed, 2 failed — the two that fail on `main` on its own. `capabilities.js`, `documentText.js` and `pdfTextExtract.js` were in this batch at first and are not any more: probing which optional tools the machine has, and reading a document's text, are their own ground, and bringing them here turned three of `main`'s own tests red.
cerede2000
pushed a commit
to cerede2000/NextExplorer
that referenced
this pull request
Sep 26, 2026
The batch is reversed, so its findings move from PORT to DONE in the same commit that sends them. What is left to reverse is whatever `scripts/parity.mjs` still reports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P3-10 of phase 3 (see #373). Stacked on #433–#441.
exifrwas last published in 2022It is the one dependency in the image whose job is to open a file somebody else wrote,
using code nobody maintains any more — and the metadata route loads it lazily, in a
try/catch, which reads like somebody was not sure of it either:
exif-readerreplaces it: maintained alongside sharp, and it does nothing but walk aTIFF-shaped block with a bounds check on every read. The block needs no file access of its
own — sharp already opens the image to report its dimensions and hands the raw EXIF block
back with them — so a photograph's details come from one pass instead of two, and
exifrleaves
backend/package.json.What the block is read for
utils/exifDetails.js: when the picture was taken, the camera and lens, the exposure, theorientation, the place. Its own file because the metadata route is about what kind of
thing a file is, and this is about what a photograph says of itself.
Checks
exif-details.test.js, 20 tests over the reading itself: a block that is not EXIF,a truncated one, dates in the three shapes cameras write them, a rational that divides
by zero, coordinates in both hemispheres. Making the reader answer nothing turns six
of them red.
metadata.test.js, 13 tests through the route.mainalone.exifrgone.capabilities.js,documentText.jsandpdfTextExtract.jswere in this batch at firstand are not any more: probing which optional tools the machine has, and reading a
document's text, are their own ground, and bringing them here turned three of
main's owntests red.