mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-04 11:37:22 +00:00
fix(update): APK asset URL used stale '-release' filename — downloads 404'd
Since v4.4.6-ba7opf.9.9 releases are uploaded as Look4Sat-<version>.apk (no
'-release' suffix), but parseRelease still built the download URL as
Look4Sat-<version>-release.apk. Update check succeeded (page parses) while the
download 404'd ('下载失败请重试'). Align the generated URL with the actual
asset name; mirror-prefixed URLs fixed too.
This commit is contained in:
1 parent
cd3eded77c
commit
237e4cb27a
1 file changed
+6
-4
+6
-4
@@ -66,16 +66,18 @@ class UpdateRepository(
|
|||||||
.replace("<", "<").replace(">", ">").replace("&", "&")
|
.replace("<", "<").replace(">", ">").replace("&", "&")
|
||||||
.replace(""", "\"").replace("'", "'")
|
.replace(""", "\"").replace("'", "'")
|
||||||
.trim()
|
.trim()
|
||||||
// The release APK asset follows the fixed naming scheme used by the build:
|
// The release APK asset naming: Look4Sat-<tag without leading v>.apk
|
||||||
// Look4Sat-<tag without leading v>-release.apk. When the page was fetched
|
// (since v4.4.6-ba7opf.9.9 the releases are uploaded with the bare
|
||||||
|
// versioned filename, no "-release" suffix). When the page was fetched
|
||||||
// through an accelerator mirror (https://<mirror>/https://github.com/...),
|
// through an accelerator mirror (https://<mirror>/https://github.com/...),
|
||||||
// download through the same mirror — raw github.com is unreachable on the
|
// download through the same mirror — raw github.com is unreachable on the
|
||||||
// networks that needed the mirror in the first place.
|
// networks that needed the mirror in the first place.
|
||||||
val mirrorPrefix = sourceUrl.substringBefore("https://github.com")
|
val mirrorPrefix = sourceUrl.substringBefore("https://github.com")
|
||||||
|
val apkName = "Look4Sat-${tag.removePrefix("v")}.apk"
|
||||||
val apkUrl = if (mirrorPrefix.isEmpty()) {
|
val apkUrl = if (mirrorPrefix.isEmpty()) {
|
||||||
"$DOWNLOAD_BASE_URL/$tag/Look4Sat-${tag.removePrefix("v")}-release.apk"
|
"$DOWNLOAD_BASE_URL/$tag/$apkName"
|
||||||
} else {
|
} else {
|
||||||
"${mirrorPrefix}https://github.com/atsunatsu/Look4Sat/releases/download/$tag/Look4Sat-${tag.removePrefix("v")}-release.apk"
|
"${mirrorPrefix}https://github.com/atsunatsu/Look4Sat/releases/download/$tag/$apkName"
|
||||||
}
|
}
|
||||||
return LatestRelease(
|
return LatestRelease(
|
||||||
versionTag = tag,
|
versionTag = tag,
|
||||||
|
|||||||
Reference in new issue
Block a user