1
0
Fork 0

fix url is too long to be a path error

This commit is contained in:
Nick Sweeting 2020-08-18 08:23:57 -04:00
parent e3ac4c2405
commit 2e2b4f8150

View file

@ -25,6 +25,7 @@ def parse_generic_txt_export(text_file: IO[str]) -> Iterable[Link]:
continue continue
# if the line is a local file path that resolves, then we can archive it # if the line is a local file path that resolves, then we can archive it
try:
if Path(line).exists(): if Path(line).exists():
yield Link( yield Link(
url=line, url=line,
@ -33,6 +34,9 @@ def parse_generic_txt_export(text_file: IO[str]) -> Iterable[Link]:
tags=None, tags=None,
sources=[text_file.name], sources=[text_file.name],
) )
except (OSError, PermissionError):
# nvm, not a valid path...
pass
# otherwise look for anything that looks like a URL in the line # otherwise look for anything that looks like a URL in the line
for url in re.findall(URL_REGEX, line): for url in re.findall(URL_REGEX, line):