-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood contributionSuitable for contribution, but unlike "good first issue", it may need prior experienceSuitable for contribution, but unlike "good first issue", it may need prior experiencepdfRelated to PDF export or PDF embedding.Related to PDF export or PDF embedding.scriptingAbout Typst's coding capabilitiesAbout Typst's coding capabilities
Description
Description
The pdf.embed function is documented as taking an optional positional argument for file data. However, that the argument is interpreted as none—and consequentially ignored—if it is anything but bytes. This leads to hard to diagnose behavior when such data is supplied by decoding (i.e. cbor) or has otherwise dynamic type. Instead, the implementation tries to read the actual file referenced by the path. Note this fault may silently incorrectly (!) succeed.
#pdf.embed("example.txt", "oops-this-is-text")
error: file not found (searched at /tmp/example.txt)
┌─ what.typ:1:11
│
1 │ #pdf.embed("example.txt", "oops-this-is-text")
│ ^^^^^^^^^^^^^
Expected behavior
error: invalid argument type, expected bytes, got string
┌─ what.typ:1:11
│
1 │ #pdf.embed("example.txt", "oops-this-is-text")
│ ^^^^^^^^^^^^^^^^^^^
Reproduction URL
No response
Operating system
Linux
Typst version
- I am using the latest version of Typst
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood contributionSuitable for contribution, but unlike "good first issue", it may need prior experienceSuitable for contribution, but unlike "good first issue", it may need prior experiencepdfRelated to PDF export or PDF embedding.Related to PDF export or PDF embedding.scriptingAbout Typst's coding capabilitiesAbout Typst's coding capabilities