Fix relative paths bug

Introduced in 74ea039458
This commit is contained in:
Christophe 2020-12-02 18:40:45 +01:00
parent 49a0ca7a7c
commit 6426060804

View File

@ -37,14 +37,15 @@ def main() -> None:
cookie_jar.load_cookies() cookie_jar.load_cookies()
folder = args.folder folder = Path(args.folder)
if args.folder is None: if args.folder is None:
folder = crawler.find_element_name(args.url) folder = Path(crawler.find_element_name(args.url))
cookie_jar.save_cookies() cookie_jar.save_cookies()
# files may not escape the pferd_root with relative paths # files may not escape the pferd_root with relative paths
# note: Path(Path.cwd, Path(folder)) == Path(folder) if it is an absolute path # note: Path(Path.cwd, Path(folder)) == Path(folder) if it is an absolute path
pferd_root = Path(Path.cwd(), Path(folder)).parent pferd_root = Path(Path.cwd(), Path(folder)).parent
folder = folder.name
pferd = Pferd(pferd_root, test_run=args.test_run) pferd = Pferd(pferd_root, test_run=args.test_run)
def dir_filter(_: Path, element: IliasElementType) -> bool: def dir_filter(_: Path, element: IliasElementType) -> bool: