From 47f0f7bbb6d8322f12d90eb6f4236116e91bbe85 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 10 Mar 2026 11:44:12 -0600 Subject: [PATCH] fix source archive filenames and download URLs Use Owner-Repo-Tag naming (e.g. BeyondCodeBootcamp-aliasman-v1.1.2.tar.gz) and direct codeload.github.com URLs instead of api.github.com tarball_url. This matches the Node.js behavior for source-only packages (aliasman, duckdns.sh, serviceman) where the extracted directory name matters for install script globbing (mv ./*aliasman*/ ...). Remaining diff: Node.js follows the redirect to get the git short hash suffix (-0-g{hash}) from Content-Disposition. Go uses the tag name directly. Both resolve to the same archive content. --- cmd/webicached/main.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cmd/webicached/main.go b/cmd/webicached/main.go index ac3f908..9e23008 100644 --- a/cmd/webicached/main.go +++ b/cmd/webicached/main.go @@ -506,28 +506,42 @@ func classifyGitHub(pkg string, conf *installerconf.Conf, d *rawcache.Dir) ([]st // Source archives for packages with no binary assets. // These are installable on any POSIX system (shell scripts, etc.). + // + // GitHub's tarball/zipball URLs (api.github.com/repos/.../tarball/TAG) + // redirect to codeload.github.com which serves the archive with a + // Content-Disposition filename like: Owner-Repo-ShortHash.tar.gz + // The extracted directory uses the same name, which install scripts + // depend on for globbing (e.g. mv ./*aliasman*/ ...). + // + // We construct the codeload URL directly (deterministic) and use + // Owner-Repo-Tag as the filename. The actual extracted directory + // will be Owner-Repo-ShortHash but the download URL resolves the same. if len(rel.Assets) == 0 { + owner, repo := conf.Owner, conf.Repo + tag := rel.TagName if rel.TarballURL != "" { + dlURL := fmt.Sprintf("https://codeload.github.com/%s/%s/legacy.tar.gz/refs/tags/%s", owner, repo, tag) assets = append(assets, storage.Asset{ - Filename: rel.TagName + ".tar.gz", + Filename: owner + "-" + repo + "-" + tag + ".tar.gz", Version: version, Channel: channel, OS: "posix_2017", Arch: "*", Format: ".tar.gz", - Download: rel.TarballURL, + Download: dlURL, Date: date, }) } if rel.ZipballURL != "" { + dlURL := fmt.Sprintf("https://codeload.github.com/%s/%s/legacy.zip/refs/tags/%s", owner, repo, tag) assets = append(assets, storage.Asset{ - Filename: rel.TagName + ".zip", + Filename: owner + "-" + repo + "-" + tag + ".zip", Version: version, Channel: channel, OS: "posix_2017", Arch: "*", Format: ".zip", - Download: rel.ZipballURL, + Download: dlURL, Date: date, }) }