🐛 fix(spx): GITEA_TOKEN 只发给 tea 登录过的 host,origin 不在 tea 里时直接报错

This commit is contained in:
cruldra committed 2026-10-19 08:50:20 +11:00
1 parent e6d086d821
commit 9c7c9d8636
6 files changed
+43 -25

No files matched your search

+2 -2
View File
@@ -59,8 +59,8 @@ func load(path string) (*TeaConfig, error) {
//
// Hosts are compared by hostname only, ignoring case, scheme, port and trailing slashes, so the host read from a git
// SSH remote still finds the login saved with the forge's web URL. When several logins point at `host`, the one marked
// `default` wins, because that is the identity the user picked; otherwise the first. A missing config file is not an
// error either, because the caller can still fall back to `GITEA_TOKEN`.
// `default` wins, because that is the identity the user picked; otherwise the first. A missing config file just means
// there is no login, so it returns `nil` rather than an error.
func LoginForHost(path, host string) (*TeaLogin, error) {
cfg, err := load(path)
if errors.Is(err, fs.ErrNotExist) {