Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the pkg url contains a question mark, extraction will fail #29

Open
Pretzelek opened this issue Nov 8, 2021 · 0 comments
Open

If the pkg url contains a question mark, extraction will fail #29

Pretzelek opened this issue Nov 8, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Pretzelek
Copy link

Duplication steps:
pynps -G -c psp -r usa "talkman travel tokyo"

[SEARCH] you're going to download the following files:

  1. PSP | NPUG80155 | USA | Game | TALKMAN TRAVEL TOKYO [17.72 MiB]
    Download files? [y/n]: y

[DOWNLOAD] TALKMAN TRAVEL TOKYO (US) [NPUG80155] for PSP
w2kCvtC25dQdGqSeGgl1oJel2ywCHKxvecsJJTIje4Pc6AMGmMJdIeyxX2pgY7d97pnjrYwVKUkGBj1 100%[====================================================================================================================================================================================================>] 17.72M 43.8MB/s in 0.4s

Traceback (most recent call last):
File "d:\python3\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python3\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "D:\Python3\Scripts\pynps.exe_main
.py", line 9, in
File "d:\python3\lib\site-packages\pynps\cli\cli.py", line 561, in cli_main
sha256_dl = checksum_file(downloaded_file_loc)
File "d:\python3\lib\site-packages\pynps\functions\functions.py", line 532, in checksum_file
with open(file, 'rb') as f:
OSError: [Errno 22] Invalid argument: 'G:/Games/pynps/PKG/PSP/GAMES/w2kCvtC25dQdGqSeGgl1oJel2ywCHKxvecsJJTIje4Pc6AMGmMJdIeyxX2pgY7d97pnjrYwVKUkGBj1Aca5vWHX9PeD7Sc099Dx7e.pkg?product=0084&country=us'

'?' in the URL gets turned into '@', but pynps is still looking for the file with '?'.

This can be fixed by adding
dl_dile_loc = dl_dile_loc.replace("?", "@") in cli.py, after
dl_dile_loc = f"{DLFOLDER}/PKG/{i['System']}/{i['Type']}/{i['PKG direct link'].split('/')[-1]}" as well as replacing

open(file, 'rb') as f:
with
open(file.replace("?", "@"), 'rb') as f:

in cli.py.

@evertonstz evertonstz added the bug Something isn't working label Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants