Skip to content

Commit

Permalink
Add a workaround for KB5043178 extra link
Browse files Browse the repository at this point in the history
  • Loading branch information
m417z committed Oct 1, 2024
1 parent babff25 commit 66a489d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions data/upd02_get_manifests_from_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def search_for_updates(search_terms):
return matches


def get_update_download_url(update_uid):
def get_update_download_url(update_uid, update_kb):
input_json = [{
'uidInfo': update_uid,
'updateID': update_uid
Expand All @@ -52,6 +52,12 @@ def get_update_download_url(update_uid):

p = r'\ndownloadInformation\[\d+\]\.files\[\d+\]\.url = \'([^\']+)\';'
matches = re.findall(p, html)

# For some reason (bug?), the KB5043178 update has two links, one for
# KB5043080 as well.
if len(matches) != 1 and update_kb == 'KB5043178':
matches = [x for x in matches if '/windows11.0-kb5043080-' not in x]

if len(matches) != 1:
raise Exception(f'Expected one downloadInformation item, found {len(matches)}')

Expand Down Expand Up @@ -115,7 +121,7 @@ def get_update(windows_version, update_kb):
def download_update(windows_version, update_kb):
update_uid, update_title = get_update(windows_version, update_kb)

download_url = get_update_download_url(update_uid)
download_url = get_update_download_url(update_uid, update_kb)
if not download_url:
raise Exception('Update not found in catalog')

Expand Down

0 comments on commit 66a489d

Please sign in to comment.