Fixed filename url parse

This commit is contained in:
Dimitris Zlatanidis 2023-01-17 22:13:23 +02:00
parent 8d091b4ec0
commit 4eab533aef
2 changed files with 6 additions and 2 deletions

View file

@ -4,6 +4,7 @@
import hashlib
from pathlib import Path
from typing import Union
from urllib.parse import unquote
from slpkg.views.ascii import Ascii
from slpkg.views.views import ViewMessage
@ -18,7 +19,8 @@ class Md5sum:
def check(self, path: Union[str, Path], source: str, checksum: str, name: str):
""" Checksum the source. """
source_file = Path(path, source.split('/')[-1])
filename = unquote(source)
source_file = Path(path, filename.split('/')[-1])
md5 = self.read_file(source_file)

View file

@ -4,6 +4,7 @@
import subprocess
from pathlib import Path
from typing import Union
from urllib.parse import unquote
from multiprocessing import Process
from slpkg.configs import Configs
@ -42,7 +43,8 @@ class Downloader(Configs):
def check_if_downloaded(self):
""" Checks if the file downloaded. """
file = self.url.split('/')[-1]
url = unquote(self.url)
file = url.split('/')[-1]
path_file = Path(self.path, file)
if not path_file.exists():
raise SystemExit(f"\n{self.red}FAILED {self.output}:{self.endc} '{self.blue}{self.url}{self.endc}' "