From c7d6fc178a83df716b312d6df02993fde6e80ab9 Mon Sep 17 00:00:00 2001 From: kokobhara <146670393+kokobhara@users.noreply.github.com> Date: Thu, 18 Apr 2024 22:10:33 +0530 Subject: [PATCH] Download only with the major number --- mozdownload/scraper.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mozdownload/scraper.py b/mozdownload/scraper.py index a9ae5d2f..788bf11a 100755 --- a/mozdownload/scraper.py +++ b/mozdownload/scraper.py @@ -709,20 +709,21 @@ def get_build_info(self): def query_versions(self, version=None): """Check specified version and resolve special values.""" - if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS: - return [version] - url = urljoin(self.base_url, 'releases/') parser = self._create_directory_parser(url) - if version: - versions = parser.filter(latest_version_filter(version, self.application)) - import mozilla_version - MozVersion = getattr(mozilla_version, APPLICATIONS_TO_VERSION_CLASS[self.application]) - versions.sort(key=MozVersion.parse) - return [versions[-1]] - else: + + if not version: return parser.entries + if version not in RELEASE_AND_CANDIDATE_LATEST_VERSIONS: + versions = parser.filter(version) + else: + versions = parser.filter(latest_version_filter(version, self.application)) + import mozilla_version + MozVersion = getattr(mozilla_version, APPLICATIONS_TO_VERSION_CLASS[self.application]) + versions.sort(key=MozVersion.parse) + return [versions[-1]] + class ReleaseCandidateScraper(ReleaseScraper): """Class to download a release candidate build of a Gecko based application."""