summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcAttte <26514199+cAttte@users.noreply.github.com>2025-06-12 11:10:04 -0300
committerGitHub <noreply@github.com>2025-06-12 14:10:04 +0000
commit4a638f41cde37312390359a5345073bed5835ae6 (patch)
tree155167a5a20d52469478e65f0d8275ddfa81e16e
parentf9897479d2a8a865c4033bc44ec9a85fb5000795 (diff)
Consume `data` argument in `pdf.embed()` (#6435)
-rw-r--r--crates/typst-library/src/pdf/embed.rs2
-rw-r--r--tests/suite/pdf/embed.typ4
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/typst-library/src/pdf/embed.rs b/crates/typst-library/src/pdf/embed.rs
index f902e7f1..4c01cd65 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::<Bytes>()? {
+ match args.eat::<Bytes>()? {
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 83f006d6..4546532b 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")