fix(desktop): a GitHub link to one AppImage installs and updates that variant (#2273)

* fix(desktop): a GitHub link to one AppImage installs and updates that variant

* fix(desktop): latest-release links, bad escapes and 32/64-bit variants

A /releases/latest/download/<file>.AppImage link now names its asset too, a
malformed %-escape in the field no longer throws while the dialog composes,
and x86-32 and x86_64 assets no longer collapse to the same variant once
version numbers are dropped.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-08 08:07:28 -05:00
1 parent 2beeb715fd
commit bc99cacd02
3 files changed
+57 -11

No files matched your search

@@ -64,4 +64,36 @@ class LinuxFexTest {
assertEquals("App-x86_64.AppImage", UserApps.pickAsset(listOf("App-x86_64.AppImage", "App-armhf.AppImage", "notes.txt")))
assertNull(UserApps.pickAsset(listOf("App-armhf.AppImage", "App-i686.AppImage")))
}
@Test fun aLinkedAssetPicksTheSameVariantInEveryRelease() {
val link = "https://github.com/Djihads80/Eglantine/releases/download/build-129/eglantine-a407703f6d29a5ab73328b4ededb12cf29b2758d-linux-aarch64.AppImage"
val wanted = UserApps.githubAsset(link)
assertEquals("eglantine-a407703f6d29a5ab73328b4ededb12cf29b2758d-linux-aarch64.AppImage", wanted)
assertEquals("Djihads80/Eglantine", UserApps.githubRepo(link))
val build = listOf("eglantine-a407703f6d29a5ab73328b4ededb12cf29b2758d-linux-aarch64-pgo.AppImage",
"eglantine-a407703f6d29a5ab73328b4ededb12cf29b2758d-linux-aarch64.AppImage")
assertEquals(build[1], UserApps.pickAsset(build, wanted))
val daily = listOf("eglantine-linux-aarch64-pgo.AppImage", "eglantine-linux-aarch64.AppImage", "eglantine-linux-x86_64.AppImage")
assertEquals("eglantine-linux-aarch64.AppImage", UserApps.pickAsset(daily, wanted))
assertEquals("eglantine-linux-aarch64-pgo.AppImage", UserApps.pickAsset(daily, "eglantine-0f3c2a91-linux-aarch64-pgo.AppImage"))
assertEquals("eglantine-linux-aarch64-pgo.AppImage", UserApps.pickAsset(daily, "Other-v2.1-x86_64.AppImage"))
assertEquals("eglantine-linux-aarch64-pgo.AppImage", UserApps.pickAsset(daily))
}
@Test fun onlyReleaseDownloadLinksNameAnAsset() {
assertNull(UserApps.githubAsset("https://github.com/Djihads80/Eglantine"))
assertNull(UserApps.githubAsset("Djihads80/Eglantine"))
assertNull(UserApps.githubAsset("https://github.com/o/r/releases/download/v1/notes.txt"))
assertEquals("My App-1.0-arm64.AppImage", UserApps.githubAsset("https://github.com/o/r/releases/download/v1.0/My%20App-1.0-arm64.AppImage"))
assertEquals("App-arm64.AppImage", UserApps.githubAsset("https://github.com/o/r/releases/latest/download/App-arm64.AppImage"))
assertEquals("o/r", UserApps.githubRepo("https://github.com/o/r/releases/latest/download/App-arm64.AppImage"))
assertNull(UserApps.githubAsset("https://github.com/o/r/releases/download/v1/bad%ZZ.AppImage"))
}
@Test fun theLinkedArchitectureWidthIsKept() {
val release = listOf("App-2.0-x86-32.AppImage", "App-2.0-x86_64.AppImage", "App-2.0-i686.AppImage")
assertEquals("App-2.0-x86_64.AppImage", UserApps.pickAsset(release, "App-1.0-x86_64.AppImage"))
assertEquals("App-2.0-x86-32.AppImage", UserApps.pickAsset(release, "App-1.0-x86-32.AppImage"))
assertEquals("App-2.0-amd64.AppImage", UserApps.pickAsset(listOf("App-2.0-i386.AppImage", "App-2.0-amd64.AppImage"), "App-1.0-x86_64.AppImage"))
}
}