Repository navigation
.ai import: placed files are found by the folder they keep relative to the document - #5176
Merged
Merged
Conversation
Contributor
|
Caution Review failedThe pull request is closed.
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. |
…o the document Squashed from storytold#5176 onto main.
bflatastic
force-pushed
the
fix/ai-os19
branch
from
November 2, 2026 07:50
8826364 to
0e38796
Compare
Member
|
Merged, thanks @dotCooCoo! It went in with this round's batch after a full CI run and a live check. |
3 of 4 tasks
4 tasks done
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.
What and why
A placed (linked) file in a
.aifile's editing data keeps, next to its absolute path, the folder it is in relative tothe document (
src/). The reader dropped that folder. When a document and its links moved together, the Links panelfound 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,096bytes 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(onmainat1c4a7831eb):cargo fmt --all -- --checkcargo clippy -p vectorcraft-eps -p vectorcraft-engine --all-targets -- -D warningscargo test -p vectorcraft-eps: 542 passedcargo test -p vectorcraft-engine --lib -- links aiimport: 107 passedcargo xtask brands,cargo xtask layers,cargo xtask assetsThis branch merges cleanly with
mainat639c9d6ce9, andcargo check --workspace --testspasses on the mergedtree. It conflicts with #5046 (the
uselines ofcrates/eps/src/import/ai/read/directives.rsand the.aiparagraph ofdocs/file-format-parity.md) and with #5069(that paragraph); keeping both sides resolves each.
cargo xtask cipassed in this pull request's CI run on8826364177: https://github.com/storytold/vectorcraft/actions/runs/41361339795/job/125012158708Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.