Skip to content

Do not read a macOS sidecar as the image it is named after - #56

Merged
abrignoni merged 1 commit into
mainfrom
fix/appledouble-sidecars
Sep 10, 2026
Merged

abrignoni merged 1 commit into
mainfrom
fix/appledouble-sidecars

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Stacked on #55, which it shares a code block with. Merge that one first.

Copying a file onto a FAT or exFAT card makes macOS write a second file named ._<name> beside it, holding the resource fork and Finder info. It takes the whole name of the file it belongs to, so ._holiday.jpg ends in an image extension and holds no image.

The extension decided the kind, so each one was registered as an image and then failed to decode. A card that has been in a Mac carries one per file, so a case can come out with half its rows in error and nothing actually wrong.

A ._ name now has its first bytes read before its extension is believed, and a file carrying the AppleDouble magic is filed as other. Both halves are required: the name alone would throw away a real image somebody named that way, and the magic alone is four bytes another format could open with. Only ._ names pay for the read, and asking for all files still records them.

Four sites: the directory scan, a walked filesystem, a zip member and a tar member. The __MACOSX/ tree a Mac zip writer makes was already skipped; these are sidecars sitting in place in an ordinary path.

Tests at each site, all red before the change. The magic is written out in the tests rather than imported.

🤖 Generated with Claude Code

Copying a file onto a FAT or exFAT card makes macOS write a second file
named ._<name> beside it, holding the resource fork and Finder info in
AppleDouble form. It takes the whole name of the file it belongs to, so
._holiday.jpg ends in an image extension and holds no image.

The extension decided the kind, so every one of them was registered as an
image and then failed to decode. A card that has been in a Mac carries one
per file, so half the rows in a case could be errors with nothing wrong.

A "._" name now has its first bytes read before the extension is believed,
and a file carrying the AppleDouble magic is filed as other. Both halves are
required: the name alone would throw away a real image somebody named that
way, and the magic alone is four bytes another format could open with. Only
"._" names pay for the read.

Four sites: the directory scan, a walked filesystem, a zip member and a tar
member. The __MACOSX/ tree a Mac zip writer makes was already skipped; these
are sidecars sitting in place in an ordinary path.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abrignoni
abrignoni changed the base branch from fix/walked-stage-duplicates-head to main September 10, 2026 10:50
@abrignoni
abrignoni merged commit c86bebc into main Sep 10, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/appledouble-sidecars branch September 10, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant