Skip to content

.ai import: placed files are found by the folder they keep relative to the document - #5176

Merged
bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/ai-os19
Nov 2, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
dotCooCoo:fix/ai-os19

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

What and why

A placed (linked) file in a .ai file's editing data keeps, next to its absolute path, the folder it is in relative to
the document (src/). The reader dropped that folder. When a document and its links moved together, the Links panel
found the file only at its old path or right next to the document, and showed the low-resolution preview everywhere
else.

"Linked files use relative paths to track their source files. If you move an Illustrator document and its linked files
together, keeping their relative locations intact, the links remain intact."
(Links panel overview)

With this change the link takes that folder and the file's name as its relative path, which the link lookup already
tries after the absolute path. A file found there is read as the document opens, and its link takes that file's size,
modification time and hash. A file that isn't found keeps its path, its relative path and the preview, and its link
has no size, time or hash. The folder is read on %_ lines too. A folder that is empty, absolute, longer than 4,096
bytes or not a string, or a section that doesn't end, leaves the link as it was before.

How it was tested

New tests build their editing data from scratch:

  • crates/eps/src/import/ai/tests.rs: a_placed_file_keeps_its_folder_relative_to_the_document (relative, ..,
    backslash and space-padded folders, the hidden form, and the folders that are left out, a name operand among them).
  • crates/engine/src/tests/links.rs: links_of_an_imported_file_are_found_by_their_relative_folder (missing: no size,
    time or hash; found in src/ beside the moved document: read, with its size and hash).
  • crates/engine/tests/import_fuzz.rs: relative folder sections in the hostile editing data tokens.

Both tests fail without the change. Commands run on 8826364177 (on main at 1c4a7831eb):

  • cargo fmt --all -- --check
  • cargo clippy -p vectorcraft-eps -p vectorcraft-engine --all-targets -- -D warnings
  • cargo test -p vectorcraft-eps: 542 passed
  • cargo test -p vectorcraft-engine --lib -- links aiimport: 107 passed
  • cargo xtask brands, cargo xtask layers, cargo xtask assets

This branch merges cleanly with main at 639c9d6ce9, and cargo check --workspace --tests passes on the merged
tree. It conflicts with #5046 (the use lines of
crates/eps/src/import/ai/read/directives.rs and the .ai paragraph of docs/file-format-parity.md) and with #5069
(that paragraph); keeping both sides resolves each.

cargo xtask ci passed in this pull request's CI run on 8826364177: https://github.com/storytold/vectorcraft/actions/runs/41361339795/job/125012158708

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@bflatastic
bflatastic merged commit 522280d into storytold:main Nov 2, 2026
2 checks passed
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @dotCooCoo! It went in with this round's batch after a full CI run and a live check.

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.

2 participants