From 95f25fde972d39b38a15dbbd2e54fba5ce67a1f6 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Tue, 22 Mar 2022 19:14:00 -0700 Subject: [PATCH] download: Get latest build from last match instead of sorting This fails for 12L: SP2A.220305.013.A3 < SQ1D.220205.004. Google always adds builds to the bottom anyway, so just pick the last matched URL. --- src/images/download.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/images/download.ts b/src/images/download.ts index ebd011b..6656bac 100644 --- a/src/images/download.ts +++ b/src/images/download.ts @@ -64,7 +64,7 @@ async function getUrl(type: ImageType, buildId: string, device: string, cache: I } if (buildId == 'latest') { - return matches.map(m => m[1]).sort((a, b) => b.localeCompare(a))[0] + return matches[matches.length - 1][1] } return matches[0][1] }