M6: refuse an export only for a choice it could have applied

The refusal guard asked whether any item still had the layer fields, while the export walks
also require a graphic whose asset is a PDF. Relinking a placed PDF to an image keeps those
fields on the item (links.relink replaces the asset in place), so a stale field blocked IDML
and PDF/A-2b exports that used to work. The guard, and the package report, now ask the same
question the walks ask: has_applicable_pdf_layer_overrides requires the PDF asset too, so a
stale choice is simply ignored and the tripwire still fires if a future construct ever puts a
real choice where the walk cannot reach it.

Regression: a_stale_choice_on_a_relinked_image_does_not_block_exports places a layered PDF,
hides a layer, relinks that asset to a PNG and exports IDML, PDF/A-2b and plain PDF - all
succeed, and the document reports the stale field while the applicable helper does not.
This commit is contained in:
skylar taylor-barrick
2026-10-24 16:11:28 -06:00
parent 1266ce8236
commit 08876e1868
4 changed files with 52 additions and 6 deletions
+3 -2
View File
@@ -686,8 +686,9 @@ fn rasterize_layered(d: &designcraft_doc::Document) -> Result<(Option<designcraf
})
.collect();
if choices.is_empty() {
// Fail closed: a choice this walk cannot reach must not become the file's defaults.
if d.has_pdf_layer_overrides() {
// Fail closed, with the same predicate as the walk: a stale choice on an item that is no
// longer a placed PDF must not block the export.
if super::interchange::has_applicable_pdf_layer_overrides(d) {
return Err(EngineError::Other("a placed PDF's layer choice sits where this raster export cannot apply it".into()));
}
return Ok((None, 0));