diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 1904d25e..ebc5cd63 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -4,8 +4,8 @@ import shutil from typing import Union from pathlib import Path -from urllib.parse import unquote from multiprocessing import Process +from urllib.parse import unquote, urlparse from slpkg.configs import Configs from slpkg.utilities import Utilities @@ -46,7 +46,8 @@ class Downloader(Configs): def tool(self, url: str) -> None: """ Downloader tools wget, wget2, curl and lftp. """ command: str = '' - filename: str = url.split('/')[-1] + path: str = urlparse(url).path + filename: str = Path(path).name if url.startswith('file'): shutil.copy2(url[7:], self.tmp_slpkg) @@ -69,8 +70,9 @@ class Downloader(Configs): def check_if_downloaded(self, url: str) -> None: """ Checks if the file downloaded. """ url: str = unquote(url) - file: str = url.split('/')[-1] - path_file: Path = Path(self.path, file) + path: str = urlparse(url).path + filename: str = Path(path).name + path_file: Path = Path(self.path, filename) if not path_file.exists(): self.errors.raise_error_message(f"Download the '{url}' file", exit_status=20)