From d2381d20532e3f885ee8e5437d3f8c3da9473110 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20B=C3=BChler?= <48823479+adibue@users.noreply.github.com> Date: Fri, 14 Jan 2022 09:33:42 +0100 Subject: [PATCH] Changed xpath to use 'last()' When I created PR #374, the sparkle feed had just one entry. Turns out, that Docker uses the last entry of the feed for the latest version. With simply changing xpath to use `[last()]`, the version checking now behaves as expected. --- fragments/labels/docker.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fragments/labels/docker.sh b/fragments/labels/docker.sh index 5dd5e4e..1fd1b75 100644 --- a/fragments/labels/docker.sh +++ b/fragments/labels/docker.sh @@ -3,10 +3,10 @@ docker) type="dmg" if [[ $(arch) == arm64 ]]; then downloadURL="https://desktop.docker.com/mac/stable/arm64/Docker.dmg" - appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/arm64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | cut -d '"' -f2 ) + appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/arm64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[last()]' 2>/dev/null | cut -d '"' -f2 ) elif [[ $(arch) == i386 ]]; then downloadURL="https://desktop.docker.com/mac/stable/amd64/Docker.dmg" - appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/amd64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[1]' 2>/dev/null | cut -d '"' -f2 ) + appNewVersion=$( curl -fs "https://desktop.docker.com/mac/main/amd64/appcast.xml" | xpath '(//rss/channel/item/enclosure/@sparkle:shortVersionString)[last()]' 2>/dev/null | cut -d '"' -f2 ) fi expectedTeamID="9BNSXJN65R" ;;