Repository navigation
Conversation
…outside them With automation read roots in force, an SVG or SVGZ that would name a linked image's file outside them is refused before any file, folder or reply is written, with "a linked image file is outside the read roots", which names no file or folder. An <image> names the file with images: link, and with embed when the document holds no pixels for the image. With preserveEditing, the native document the SVG carries names every linked image and placed file, the relative paths kept of them and each data set's image, so those are checked too, and a stored brush entry that does not read as a brush is refused because its links cannot be checked. - The check runs where the linked JavaScript check runs: document.serialize, document.export, document.exportSelection, document.exportForScreens and assets.export, every SVG and SVGZ save, file.exportAs and the SVG Options dialog's Show Code. It also covers clipboard.exportSvg, and a Copy that an automation request asks for puts no SVG on the system clipboard when it would name such a file. - Only the art each file writes is checked: the selected objects with selectedOnly and Export Selection, the art over each chosen artboard, hidden layers and objects only when hiddenLayers is on (a save keeps them by default), never template layers or the symbol or opacity-mask editing layer, and the symbols, patterns and brushes that art uses. An image colorized with a solid fill whose pixels are gray or missing names no file, so it is not checked outside Preserve Editing. - Embedded pixels, a file inside the roots, a relative path that leads inside them and a URL are written as before, and the person at the keyboard exports every link as stored. Docs: docs/mcp.md, docs/target-app-parity.md and the params text; de and nl rows for the new message, next to the JavaScript message's rows.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 seconds. View limit details
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. |
This branch has not been deployed
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
This adds a control for automation read roots (
--automation-read-root): an SVG or SVGZ made for a confined caller no longer carries the stored path of a linked image file outside the caller's read roots. It applies the policy #7264 set for linked JavaScript files to linked images. Until now such a caller got the path in the image'shref.SVG export keeps both image modes. The SVG options on the help page (https://helpx.adobe.com/illustrator/using/saving-artwork.html) either put raster images inside the SVG file or link the SVG to JPEG or PNG images exported from the original file. Another help page (https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-other-file-types/place-multiple-files-in-a-document.html) describes a linked file as one that keeps its connection to the source file, and an embedded file as one copied into the document. The pages say nothing about read roots; the refusal below is VectorCraft's own rule.
<image>names the file withimages: "link", and withembedwhen the document holds no pixels for the image. An image whose pixels the document holds still exports embedded. An explicitlinkexport is refused rather than switched toembed.preserveEditing, the native document the SVG carries names every linked image and placed file, the relative paths kept of them and each data set's image, so all of them are checked. A stored brush entry that does not read as a brush is refused, because its links cannot be checked.document.serialize,document.export,document.exportSelection,document.exportForScreensandassets.export, every SVG and SVGZ save,file.exportAsand the SVG Options dialog's Show Code. It also coversclipboard.exportSvg, and a Copy that an automation request asks for puts no SVG on the system clipboard when it would name such a file.selectedOnlyand Export Selection, the art over each chosen artboard, hidden layers and objects only whenhiddenLayersis on (a save keeps them by default), never template layers or the symbol or opacity-mask editing layer, and the symbols, patterns and brushes that art uses. An image colorized with a solid fill whose pixels are gray or missing names no file, so it is checked only withpreserveEditing.The check is
fileio::check_linked_images(crates/engine/src/cmd/fileio/access.rs), next tocheck_linked_scripts, with its predicates incrates/engine/src/cmd/links.rs. The params text ofdocument.serialize,document.export,document.exportSelection,document.exportForScreens(whichassets.exportpoints to),document.save(shared byfile.saveAsandfile.saveCopy),clipboard.exportSvgandfile.exportAs,docs/mcp.mdand a line indocs/target-app-parity.mddescribe it. The de and nl catalogs, which have a row for the JavaScript message, get a row for the new one.How it was tested
New tests, each failing without the change:
crates/engine/src/tests/links.rs:confined_svg_output_refuses_a_linked_image_file_outside_the_read_roots:images: "link",preserveEditing, andembedwithout pixels; SVG and SVGZ; serialize, export with and without a path,selectedOnly, Export Selection,document.save,file.saveAs,file.saveCopy, Export for Screens with a PNG and an SVG row and as a ZIP, andassets.export. No file or folder is written, the error names no file or folder, the link stays, and embedded pixels still export.confined_svg_output_checks_only_the_linked_images_it_writes: hidden layers and objects (with and withouthiddenLayers, and in saves), template layers, and an unused symbol in editing mode.confined_svg_output_writes_a_colorized_gray_image_without_its_fileconfined_clipboard_svg_refuses_a_linked_image_file_outside_the_read_rootsconfined_preserve_editing_svg_refuses_a_brush_library_entry_it_cannot_readcrates/ui-egui/src/tests/automation.rs:control_svg_export_refuses_a_linked_image_file_outside_the_read_root(app.exportwith and without a path, SVGZ,preserveEditing,file.exportAs; the export at the keyboard writes the link).crates/ui-egui/src/dialogs/svg_options.rs:show_code_leaves_out_a_linked_image_file_outside_the_read_roots.svg_output_names_linked_image_files_a_caller_may_read(crates/engine/src/tests/links.rs) covers the outputs that must keep working: a link inside the roots, a relative link that leads inside them, a URL, an outside image in an unused symbol, outside images left out by a selection or by a chosen artboard, and an export without roots. It also passes without the change.Focused checks on the branch merged with
mainat0adbdce6cb:cargo fmt --all -- --checkandcargo check --workspace --testscargo clippy -p vectorcraft-engine --all-targets -- -D warningscargo test -p vectorcraft-engine --lib tests::links: 72 passed;clipboard: 69 passedcargo xtask brands,layers(30 crates) andassets(337 files)On the same branch merged with
mainat67f6d3a50f, before the last engine-only fix:cargo clippy -p vectorcraft-ui-egui --all-targets -- -D warningsandcargo clippy -p vectorcraft-mcp --all-targets -- -D warningscargo test -p vectorcraft-engine --lib tests_svg: 27 passed;linked_javascript: 2 passedcargo test -p vectorcraft-ui-egui --lib linked_image: 2 passed;show_code: 2 passed;i18n: 122 passedThe branch is one commit on
mainatbada8e1710, checked again before posting. On that commitcargo fmt -p vectorcraft-engine -p vectorcraft-ui-egui -p vectorcraft-mcp -- --checkpasses.mainatbada8e1710does not build on its own:crates/render/src/paint.rsand the tests incrates/trace/src/opaque.rsdo not compile against the pinnedcraft-image-codecs, andcargo fmt --all -- --checkreports files incrates/pdf,crates/renderandcrates/trace. This branch changes none of those files orCargo.lock.cargo xtask ciruns in this pull request's CI.Checklist
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.