Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitea driver: ignore GetOrg error if we get a valid user. #2967

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions server/forge/gitea/gitea.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import (
"context"
"crypto/tls"
"errors"
"fmt"
"net"
"net/http"
Expand Down Expand Up @@ -548,11 +549,8 @@
return nil, err
}

org, _, err := client.GetOrg(owner)
if err != nil {
return nil, err
}
if org != nil {
org, _, orgErr := client.GetOrg(owner)
if orgErr == nil && org != nil {

Check warning on line 553 in server/forge/gitea/gitea.go

View check run for this annotation

Codecov / codecov/patch

server/forge/gitea/gitea.go#L552-L553

Added lines #L552 - L553 were not covered by tests
return &model.Org{
Name: org.UserName,
Private: gitea.VisibleType(org.Visibility) != gitea.VisibleTypePublic,
Expand All @@ -561,6 +559,9 @@

user, _, err := client.GetUserInfo(owner)
if err != nil {
if orgErr != nil {
err = errors.Join(orgErr, err)
}

Check warning on line 564 in server/forge/gitea/gitea.go

View check run for this annotation

Codecov / codecov/patch

server/forge/gitea/gitea.go#L562-L564

Added lines #L562 - L564 were not covered by tests
return nil, err
}
return &model.Org{
Expand Down