mozilla / mozdownload

Easy to use download tool and API for different types of Firefox and Thunderbird builds
http://pypi.python.org/pypi/mozdownload
Other
68 stars 76 forks source link

Downloading Fenix build with invalid platform raises an index error #664

Open whimboo opened 5 months ago

whimboo commented 5 months ago

Using the following arguments from a non Android platform causes the code in DailyScraper to fail with an IndexError because there is no such build for such a platform.

mozdownload -a fenix -t daily -p mac

Traceback (most recent call last):
  File "/Users/henrik/code/mozdownload/venv/bin/mozdownload", line 33, in <module>
    sys.exit(load_entry_point('mozdownload', 'console_scripts', 'mozdownload')())
  File "/Users/henrik/code/mozdownload/mozdownload/cli.py", line 169, in cli
    build = factory.FactoryScraper(scraper_type, **kwargs)
  File "/Users/henrik/code/mozdownload/mozdownload/factory.py", line 126, in __init__
    scraper_types[scraper_type].__init__(self, **kwargs)
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 383, in __init__
    Scraper.__init__(self, *args, **kwargs)
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 165, in __init__
    self._retry_check_404(self.get_build_info)
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 180, in _retry_check_404
    self._retry(func, **retry_kwargs)
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 171, in _retry
    return redo.retry(func, **retry_kwargs)
  File "/Users/henrik/code/mozdownload/venv/lib/python3.10/site-packages/redo-2.0.4-py3.10.egg/redo/__init__.py", line 170, in retry
    return action(*args, **kwargs)
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 434, in get_build_info
    self.date = self.get_latest_build_date()
  File "/Users/henrik/code/mozdownload/mozdownload/scraper.py", line 456, in get_latest_build_date
    date = ''.join(parser.entries[-1].split('-')[:6])
IndexError: list index out of range
whimboo commented 4 months ago

PR https://github.com/mozilla/mozdownload/pull/672 fixed only one case but we should still check early when checking command line arguments if the given platform is supported by the application.

randomicon00 commented 3 months ago

Hello @whimboo, this is the first time contributing to this code base. I would like to try my hand at it!

whimboo commented 3 months ago

Be welcome @randomicon00! It's great to see your interest. Let me know if you need further help to get started. You can ask here or as well join our Matrix channel. Thanks!

whimboo commented 2 months ago

@randomicon00 have you had the time to check the exiting code? Do you have any issues where you would need help with? Thanks

randomicon00 commented 2 months ago

Hi @whimboo! I've missed your first message (didn't get an email notification for it). I will start working on the task. I've already had a look at the source code before interacting here and I don't have any particular question. Thanks!

whimboo commented 2 months ago

@randomicon00 I wanted to check in with you to see if any other issues have come up while you’ve been working on it. If you just need a bit more time, that's perfectly fine — just let me know. I want to ensure we stay in touch. Thanks!