From 4a638f41cde37312390359a5345073bed5835ae6 Mon Sep 17 00:00:00 2001 From: cAttte <26514199+cAttte@users.noreply.github.com> Date: Thu, 12 Jun 2025 11:10:04 -0300 Subject: [PATCH] Consume `data` argument in `pdf.embed()` (#6435) --- crates/typst-library/src/pdf/embed.rs | 2 +- tests/suite/pdf/embed.typ | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/typst-library/src/pdf/embed.rs b/crates/typst-library/src/pdf/embed.rs index f902e7f14..4c01cd651 100644 --- a/crates/typst-library/src/pdf/embed.rs +++ b/crates/typst-library/src/pdf/embed.rs @@ -59,7 +59,7 @@ pub struct EmbedElem { // We can't distinguish between the two at the moment. #[required] #[parse( - match args.find::()? { + match args.eat::()? { Some(data) => data, None => engine.world.file(id).at(span)?, } diff --git a/tests/suite/pdf/embed.typ b/tests/suite/pdf/embed.typ index 83f006d63..4546532b7 100644 --- a/tests/suite/pdf/embed.typ +++ b/tests/suite/pdf/embed.typ @@ -28,3 +28,7 @@ mime-type: "text/plain", description: "A test file", ) + +--- pdf-embed-invalid-data --- +// Error: 38-45 expected bytes, found string +#pdf.embed("/assets/text/hello.txt", "hello")