Updated for url filename

This commit is contained in:
Dimitris Zlatanidis 2023-04-26 22:02:56 +03:00
parent 5c7c41bb60
commit 191cb576e7

View file

@ -47,7 +47,7 @@ class Downloader(Configs):
""" Downloader tools wget, wget2, curl and lftp. """
command: str = ''
path: str = urlparse(url).path
filename: str = Path(path).name
filename: str = unquote(Path(path).name)
if url.startswith('file'):
shutil.copy2(url[7:], self.tmp_slpkg)
@ -65,13 +65,10 @@ class Downloader(Configs):
self.errors.raise_error_message(f"Downloader '{self.downloader}' not supported", exit_status=1)
self.utils.process(command)
self.check_if_downloaded(url)
self.check_if_downloaded(url, filename)
def check_if_downloaded(self, url: str) -> None:
def check_if_downloaded(self, url: str, filename: str) -> None:
""" Checks if the file downloaded. """
url: str = unquote(url)
path: str = urlparse(url).path
filename: str = Path(path).name
path_file: Path = Path(self.path, filename)
if not path_file.exists():