Skip to content

Commit 3e8d628

Browse files
authored
fix: switch to safe YAML loader (#396)
Signed-off-by: Panos Vagenas <[email protected]>
1 parent ec09786 commit 3e8d628

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docling_core/types/doc/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4354,7 +4354,7 @@ def load_from_yaml(cls, filename: Union[str, Path]) -> "DoclingDocument":
43544354
if isinstance(filename, str):
43554355
filename = Path(filename)
43564356
with open(filename, encoding="utf-8") as f:
4357-
data = yaml.load(f, Loader=yaml.FullLoader)
4357+
data = yaml.load(f, Loader=yaml.SafeLoader)
43584358
return DoclingDocument.model_validate(data)
43594359

43604360
def export_to_dict(

test/test_docling_doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ def test_export_with_precision():
19731973
yaml.dump(act_data, f, default_flow_style=False)
19741974
else:
19751975
with open(exp_file, "r", encoding="utf-8") as f:
1976-
exp_data = yaml.load(f, Loader=yaml.FullLoader)
1976+
exp_data = yaml.load(f, Loader=yaml.SafeLoader)
19771977
assert act_data == exp_data
19781978

19791979

0 commit comments

Comments
 (0)