diff --git a/services/wolf.sh b/services/wolf.sh index a1558ad..19d48d2 100644 --- a/services/wolf.sh +++ b/services/wolf.sh @@ -328,21 +328,43 @@ releases = sorted(releases, key=lambda r: r.get("released_at") or "", reverse=Tr assets = [] for r in releases: for link in r.get("assets", {}).get("links", []): + # The GitLab asset URL itself is an opaque .../package_files//download + # link with no filename/extension in it at all — confirmed live: only + # the link own "name" field carries the real filename + # (e.g. "ES-DE_x64.AppImage"), so filtering on the URL suffix (as + # this used to) matches nothing and silently fails with no + # resolvable download, even though the release genuinely has an + # AppImage asset sitting right there. + name = link.get("name", "") url = link.get("direct_asset_url") or link.get("url") or "" - if url.endswith(".AppImage"): - assets.append({"name": link.get("name", url), "browser_download_url": url}) + if name.endswith(".AppImage"): + assets.append({"name": name, "browser_download_url": url}) if assets: break matching = [a for a in assets if arch_tags and has(a["name"], arch_tags)] untagged = [a for a in assets if not has(a["name"], all_arch_tags)] pick = matching or untagged or assets -print(pick[0]["browser_download_url"] if pick else "") +# No f-string here on purpose: this whole script is wrapped in a bash +# single-quoted string (see the "python3 -c" call above it), so a single +# quote anywhere in this code — the way an f-string would normally quote +# a dict key — would terminate that bash string early. Plain +# concatenation with double-quoted literals sidesteps that entirely. +print(pick[0]["browser_download_url"] + "\t" + pick[0]["name"] if pick else "") ' 2>/dev/null) if [[ -z "$_url" ]]; then log_warning "Could not resolve download URL — get it manually from https://gitlab.com/${_project_path}/-/releases" return 1 fi - local _file="$_dir/$(basename "$_url")" + # The URL and the real filename are two different things here — GitLab's + # own asset URL is an opaque .../package_files//download link with no + # filename in it at all, so basename($_url) would save the file as + # literally "download" instead of e.g. "ES-DE_x64.AppImage". The release + # asset's own "name" field (tab-separated from the URL above) is the only + # place the real filename actually lives. + local _asset_name + _asset_name="${_url#*$'\t'}" + _url="${_url%%$'\t'*}" + local _file="$_dir/$_asset_name" curl -fL --progress-bar -o "$_file" "$_url" \ && chmod +x "$_file" \ && chown "$ACTUAL_USER:$ACTUAL_USER" "$_file" \