christianfds / manga_downloader

CLI to download manga as pdf
MIT License
2 stars 4 forks source link

program crashing on blank input when prompted for chapter selection #9

Open RawatDevanshu opened 1 year ago

RawatDevanshu commented 1 year ago
Download this manga? Y/N  Y
1 - Chapter #1
Which indexes to download?

on hitting enter without typing anything the program crashes with following error:

Traceback (most recent call last):
  File "manga_downloader/manga_downloader.py", line 118, in <module>
    manga_downloader(args)
  File "manga_downloader/manga_downloader.py", line 85, in manga_downloader
    selected_chapters, chapters = select_chapters(provider, manga)
  File "manga_downloader/manga_downloader.py", line 61, in select_chapters
    selected_chapters = parse_chapter_selection(response)
  File "manga_downloader/manga_downloader.py", line 29, in parse_chapter_selection
    chapters = chapters + [int(section_range[0])]
ValueError: invalid literal for int() with base 10: ''
Karthik-PM commented 1 year ago

assign me this issue

Alig1493 commented 1 year ago

@christianfds hope you don't mind the pr due to the inactivity. it'll probably be easier to handle with tests. I can add some coverage for it if needed.

Karthik-PM commented 1 year ago

yes thanks

christianfds commented 1 year ago

If you both ok with it. Thank you all.

@Alig1493 it would be nice to have some tests, if you want to do it I would really appreciate it. Just open an issue and i can assign it to you

Alig1493 commented 1 year ago

@christianfds looks like there are no issues. I added some test in my PR for parsing chapter selection validation. Also it would be ideal if you could define the expected behaviour when the parse selections encounter blank, empty or strings containing only whitespaces.