Skip to content

Commit f5ef359

Browse files
committed
Adding more checks for linked resources during plain file parsing
1 parent e84fdf5 commit f5ef359

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

plain_file.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ def check_section_for_linked_resources(section):
9191
f"Plain syntax error: Only relative links are allowed (text: {link.node.children[0].content}, target: {link.node.target})."
9292
)
9393

94+
if not os.path.exists(link.node.target):
95+
raise PlainSyntaxError(f"Plain syntax error: Link {link.node.target} does not exist.")
96+
97+
if not os.path.isfile(link.node.target):
98+
raise PlainSyntaxError(f"Plain syntax error: Link {link.node.target} must be a file.")
99+
94100
if len(link.node.children) != 1:
95101
raise PlainSyntaxError(f"Plain syntax error: Link must have text specified (link: {link.node.target}).")
96102

0 commit comments

Comments
 (0)