You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split from #227 after rechecking its dependencies. #227 held two halves: the file fields of the document's attachments (ready: #226 is closed), and the file fields of file attachment annotations, which need those annotations (#162). The halves share the validation and the bounds.
Goal
The file name, description, and creation and modification dates of a file attachment annotation's file specification are assignable and removable as in pylopdf, and writing data sets the modification date.
Scope
In: the annotation side of ISO 32000-2, 7.11.3 and 7.11.4, direct or indirect file specifications, with the validation and bounds that #227 implements for attachments. Out: attachments (#227), the annotation itself (#162).
Paths
python/pyropdf/_annotations.py;
crates/pyropdf-engine/src/attachments/ and crates/pyropdf-engine/src/annotations/;
tests/test_file_fields.py.
Acceptance
The annotation cases of pylopdf ebb01d3c's test_file_fields.py are ported and pass, with the intended differences listed.
Notes
Reuse the field checks of #227 instead of repeating them. Split test_file_fields.py by case between #227 and this issue when claiming.
Review note: the current annotation _file_texts calls overridable len and encode methods on str subclasses. A subclass can report a small size or empty encoded bytes and bypass embedded_file_input_size. When reusing #227 validation, use the built-in string methods for the bound and add a regression with overridden methods as well as oversized Unicode input.
Also normalize validated string-subclass values to a built-in str before writing: the object encoder otherwise calls the subclass encode again, which can change validated content during serialization. The #535 review added coverage for this path.
Activity
yhay81 commentedon Nov 1, 2026
Review note: the current annotation
_file_textscalls overridablelenandencodemethods onstrsubclasses. A subclass can report a small size or empty encoded bytes and bypassembedded_file_input_size. When reusing #227 validation, use the built-in string methods for the bound and add a regression with overridden methods as well as oversized Unicode input.yhay81 commentedon Nov 1, 2026
Also normalize validated string-subclass values to a built-in
strbefore writing: the object encoder otherwise calls the subclassencodeagain, which can change validated content during serialization. The #535 review added coverage for this path.Assign and remove the file fields of attachments (#535)