is_apple_double

Function is_apple_double 

Source
fn is_apple_double(name: &str) -> bool
Expand description

Unwrap a buildingSMART .ifcZIP container (issue #1494): a plain zip archive wrapping a single .ifc/.ifcxml model file (optionally alongside referenced resources like textures — those are ignored, not extracted). Returns the model entry’s bytes so the rest of the pipeline never has to know zip existed. Mirrors the TypeScript unwrapIfcZip semantics (packages/parser/src/ifczip.ts): rejects an archive with zero or more than one candidate rather than silently guessing which model to load, and bounds the decompressed size (zip-bomb guard) against the same max_bytes ceiling the raw/gzip paths use. Whether an archive entry is a macOS AppleDouble sidecar rather than content.

Compressing in macOS Finder writes __MACOSX/._<name> beside each entry, carrying resource forks and extended attributes. It keeps the original extension, so __MACOSX/._model.ifc counted as a second model and every Mac-made archive was rejected as ambiguous (#2812, reported from production).

The test is the BASENAME, not the directory. ._ is what makes a file a sidecar; __MACOSX/ is merely where macOS puts them, so matching on it is redundant (every entry inside is already ._-prefixed) and wrong for a user whose archive genuinely contains a folder of that name. The basename form also covers a sidecar left beside its original by a rezip that flattens the directory away.

Mirrors APPLE_DOUBLE_RE in packages/parser/src/ifczip.ts. The two must agree, or an archive the browser accepts is rejected by the server.