From fd9a5349e1525cdb54861126af2985b715726113 Mon Sep 17 00:00:00 2001 From: Nerivec <62446222+Nerivec@users.noreply.github.com> Date: Tue, 7 Jan 2025 20:52:53 +0100 Subject: [PATCH] Fix AutoDL issue with new models not in cache (#645) --- .github/workflows/update_manifests.yml | 4 ++-- package.json | 2 +- src/common.ts | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_manifests.yml b/.github/workflows/update_manifests.yml index 207ca04c..39536886 100644 --- a/.github/workflows/update_manifests.yml +++ b/.github/workflows/update_manifests.yml @@ -10,8 +10,8 @@ permissions: # Limit concurrency per branch to prevent push issues. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false jobs: update-manifests: diff --git a/package.json b/package.json index 583348cf..8968e9bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zigbee-ota", - "version": "1.1.0", + "version": "1.1.1", "repository": { "type": "git", "url": "git+https://github.com/Koenkk/zigbee-OTA.git" diff --git a/src/common.ts b/src/common.ts index 81f80760..53f62853 100644 --- a/src/common.ts +++ b/src/common.ts @@ -186,7 +186,11 @@ export async function getText(manufacturer: string, pageUrl: string): Promise(list: T[], compareFn: (a: T, b: T) => number): T | undefined { +export function getLatestImage(list: T[] | undefined, compareFn: (a: T, b: T) => number): T | undefined { + if (!list) { + return undefined; + } + const sortedList = list.sort(compareFn); return sortedList.slice(0, sortedList.length > 1 && process.env.PREV ? -1 : undefined).pop();