firecrawl / firecrawl/anydoc

doc: Apple textutil-authored .doc is rejected at open — cfb reports "Malformed MiniFAT (mini sector 0 pointed to twice)"

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
bug P3
Dominant language
Rust
Stars
21.5k
Forks
1.3k
Avg merge
42m
Merged PRs (30d)
17

Description

## Summary

`.doc` files authored by Apple's Cocoa exporter (TextEdit "Save as… Word 97", `textutil -convert doc`) are rejected at open:

```
malformed document: not an OLE2 compound file: Malformed MiniFAT (mini sector 0 pointed to twice)
```

Word-authored `.doc` files convert fine, including this repo's fixtures. So this only matters where macOS-authored `.doc` uploads occur (in our pipeline: e-mail attachments written by TextEdit).

## Reproduction

On any Mac (this one: macOS 26.2, build 25C56):

```
printf 'Alpha paragraph.\n\nBeta paragraph.\n' | textutil -stdin -convert doc -output textedit-minimal.doc
```

Converting `textedit-minimal.doc` at v0.1.6 / HEAD `8eecca5` (Node binding and `cargo run --example convert` agree) yields the error above.

Sample (19 KB, generated exactly as shown): [textedit-minimal.doc](https://github.com/H0rowitz/anydoc/raw/apple-doc-sample/issue-samples/textedit-minimal.doc)

## Analysis, as far as we took it

anydoc already opens OLE2 containers with the `cfb` crate's *lenient* mode (`CompoundFile::open`), so this is a shape Apple's writer emits that even lenient mode refuses — the pointwise fix probably lives in the `cfb` crate (or in a pre-repair pass on anydoc's side). Filing here first since it presents as an anydoc capability boundary and you may prefer to route or track it your own way; we have not diagnosed which MiniFAT invariant the Apple writer actually violates (the message suggests a mini-sector chain that self-references or is doubly linked). Happy to dig further or file it against `cfb` directly if that's more useful.

Low urgency from our side — flagging it mostly so the boundary is a known, recorded one rather than a surprise.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the provided textutil command and issue-samples/textedit-minimal.doc. Start at the cfb CompoundFile::open path used by anydoc, then compare the cargo run --example convert and Node binding behavior. Done means establishing a supported handling path for this sample or documenting and routing the MiniFAT incompatibility to cfb.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rust
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.