mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-17 07:52:45 +08:00
Guard against files that don't end in .[1...9]
It seems smart to only let files be parsed that are clearly manpage files. Other files wouldn't be openend by man so I think it is safe to guess that only these files are man pages.
This commit is contained in:
parent
8d97a85834
commit
22493c9df8
|
@ -736,12 +736,14 @@ def parse_manpage_at_path(manpage_path, output_directory):
|
|||
fd = lzma.LZMAFile(str(manpage_path), 'r')
|
||||
manpage = fd.read()
|
||||
if IS_PY3: manpage = manpage.decode('latin-1')
|
||||
else:
|
||||
elif manpage_path.endswith((".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8", ".9")):
|
||||
if IS_PY3:
|
||||
fd = open(manpage_path, 'r', encoding='latin-1')
|
||||
else:
|
||||
fd = open(manpage_path, 'r')
|
||||
manpage = fd.read()
|
||||
else:
|
||||
return
|
||||
fd.close()
|
||||
|
||||
manpage = str(manpage)
|
||||
|
|
Loading…
Reference in New Issue
Block a user