fix(updater): 官方仓库 404 不再提示私有仓库

This commit is contained in:
Lemon-miaow committed 2026-10-02 18:12:29 +08:00
1 parent 80141deeb5
commit 8d78d245b2
3 files changed
+27 -8

No files matched your search

+14
View File
@@ -223,4 +223,18 @@ func TestGitHubNamesTheTokenOnAnUnauthenticated404(t *testing.T) {
if strings.Contains(err.Error(), tokenEnv) {
t.Errorf("a 404 WITH a token set must not blame the missing token; got: %v", err)
}
// The official repository is public: a 404 there means no stable release, whatever
// the token.
g.token = ""
_, err = g.latestStable(context.Background(), "felismc/felis")
if err == nil {
t.Fatal("want an error on 404")
}
if strings.Contains(err.Error(), tokenEnv) || strings.Contains(err.Error(), "private") {
t.Errorf("a 404 from the public official repository must not suggest it is private; got: %v", err)
}
if !strings.Contains(err.Error(), "no published stable release") {
t.Errorf("a 404 from the official repository must say it has no stable release; got: %v", err)
}
}