mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-29 10:26:12 +01:00
Updated for filename
This commit is contained in:
parent
0d5d779722
commit
a7d7c958ee
1 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue