fix: third-party GitHub mirrors only serve downloads with a trusted digest (#1057)

fix: a third-party GitHub mirror can only serve downloads that carry a trusted digest

Downloads without an expected SHA-256 were still sent through gh-proxy,
ghfast and other mirrors, and the first answer was accepted, so a mirror
could swap an AppImage or a Windows component. Downloader.downloadFile
now tries only the original URL when there is no digest. UserApps passes
GitHub's own asset digest, and WinComponents passes the snapshot's
archive digest, so those large files keep their mirror fallback.

Co-authored-by: ovurrsl <ovurrsl@users.noreply.github.com>
Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-10-22 10:12:33 -04:00
1 parent d9328c39df
commit 87e4b42ed8
4 files changed
+23 -6

No files matched your search

@@ -167,4 +167,10 @@ class DownloaderResumeTest {
assertEquals(listOf(catalog), DownloadSource.candidates(catalog))
}
@Test fun withoutADigestOnlyTheOriginalUrlIsTried() {
val url = "https://github.com/owner/repo/releases/download/v1/app.AppImage"
assertEquals(listOf(url), Downloader.sources(url, null))
assertEquals(DownloadSource.candidates(url), Downloader.sources(url, "a".repeat(64)))
}
}