Linux updater: take the package name from the release asset, not the download URL.

Forgejo can hand out /attachments/<uuid> links; the release API's own
names stay authoritative. (The v0.4.19 updater already works against
releases/latest, which returns named download URLs.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
oliver 2026-10-14 10:39:34 +08:00
parent 4508d5e9d2
commit 9b2c72fe4f

View file

@ -318,6 +318,8 @@ def _release_to_candidate(rel: dict, source: str, arch: str, api_url: str = "")
return {
"source": source,
"latest": tag.lstrip("vV"),
# Forgejo serves /attachments/<uuid>: the URL does not carry the file name.
"name": str(pkg["name"]),
"url": url_of(pkg),
"sha256_url": url_of(sha) if sha else "",
"sha256": "",
@ -581,7 +583,7 @@ def cmd_fetch_update(a: argparse.Namespace) -> None:
if work.exists():
shutil.rmtree(work)
work.mkdir(parents=True)
name = Path(urllib.parse.urlparse(info["url"]).path).name or "netx-update.tar.gz"
name = str(info.get("name") or "") or Path(urllib.parse.urlparse(info["url"]).path).name
if not asset_name_re(a.arch).match(name):
die("unexpected_asset_name", name)
pkg = work / name