Only show warning when file that is filtered exists

This commit is contained in:
Kovid Goyal 2023-06-08 13:55:45 +05:30
parent f33136e7e1
commit c0f2581f55
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -269,7 +269,8 @@ class HTMLInput(InputFormatPlugin):
q = os.path.normcase(get_long_path_name(link)) q = os.path.normcase(get_long_path_name(link))
if not q.startswith(self.root_dir_of_input): if not q.startswith(self.root_dir_of_input):
if not self.opts.allow_local_files_outside_root: if not self.opts.allow_local_files_outside_root:
self.log.warn('Not adding {} as it is outside the document root: {}'.format(q, self.root_dir_of_input)) if os.path.exists(q):
self.log.warn('Not adding {} as it is outside the document root: {}'.format(q, self.root_dir_of_input))
return None, None return None, None
return link, frag return link, frag