Skip to content

Commit 470003c

Browse files
Merge branch 'main' into latestgap
2 parents 2a60913 + 39f145a commit 470003c

File tree

19 files changed

+25
-47
lines changed

19 files changed

+25
-47
lines changed

models/actions/run_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
187187
return StatusCancelled
188188
case hasRunning:
189189
return StatusRunning
190-
case hasFailure:
191-
return StatusFailure
192190
case hasWaiting:
193191
return StatusWaiting
192+
case hasFailure:
193+
return StatusFailure
194194
case hasBlocked:
195195
return StatusBlocked
196196
default:

models/actions/run_job_status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestAggregateJobStatus(t *testing.T) {
6464
{[]Status{StatusFailure, StatusSuccess}, StatusFailure},
6565
{[]Status{StatusFailure, StatusSkipped}, StatusFailure},
6666
{[]Status{StatusFailure, StatusCancelled}, StatusCancelled},
67-
{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
67+
{[]Status{StatusFailure, StatusWaiting}, StatusWaiting},
6868
{[]Status{StatusFailure, StatusRunning}, StatusRunning},
6969
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},
7070

models/issues/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer)
413413
return committer.Commit()
414414
}
415415

416-
// GetGitRefName returns git ref for hidden pull request branch
416+
// GetGitHeadRefName returns git ref for hidden pull request branch
417417
func (pr *PullRequest) GetGitHeadRefName() string {
418418
return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index)
419419
}

modules/migration/pullrequest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (p *PullRequest) IsForkPullRequest() bool {
4949
return p.Head.RepoFullName() != p.Base.RepoFullName()
5050
}
5151

52-
// GetGitRefName returns pull request relative path to head
52+
// GetGitHeadRefName returns pull request relative path to head
5353
func (p PullRequest) GetGitHeadRefName() string {
5454
return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number)
5555
}

modules/storage/storage.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ type Object interface {
5959
// ObjectStorage represents an object storage to handle a bucket and files
6060
type ObjectStorage interface {
6161
Open(path string) (Object, error)
62-
// Save store a object, if size is unknown set -1
62+
63+
// Save store an object, if size is unknown set -1
64+
// NOTICE: Some storage SDK will close the Reader after saving if it is also a Closer,
65+
// DO NOT use the reader anymore after Save, or wrap it to a non-Closer reader.
6366
Save(path string, r io.Reader, size int64) (int64, error)
67+
6468
Stat(path string) (os.FileInfo, error)
6569
Delete(path string) error
6670
URL(path, name, method string, reqParams url.Values) (*url.URL, error)

routers/api/packages/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func verifyAuth(r *web.Router, authMethods []auth.Method) {
9999
ctx.Doer, err = authGroup.Verify(ctx.Req, ctx.Resp, ctx, ctx.Session)
100100
if err != nil {
101101
log.Error("Failed to verify user: %v", err)
102-
ctx.HTTPError(http.StatusUnauthorized, "authGroup.Verify")
102+
ctx.HTTPError(http.StatusUnauthorized, "Failed to authenticate user")
103103
return
104104
}
105105
ctx.IsSigned = ctx.Doer != nil

routers/api/packages/conan/auth.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataS
3434

3535
u, err := user_model.GetUserByID(req.Context(), packageMeta.UserID)
3636
if err != nil {
37-
log.Error("GetUserByID: %v", err)
3837
return nil, err
3938
}
4039
if packageMeta.Scope != "" {

routers/api/packages/conan/conan.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ func jsonResponse(ctx *context.Context, status int, obj any) {
5555
// https://github.com/conan-io/conan/issues/6613
5656
ctx.Resp.Header().Set("Content-Type", "application/json")
5757
ctx.Status(status)
58-
if err := json.NewEncoder(ctx.Resp).Encode(obj); err != nil {
59-
log.Error("JSON encode: %v", err)
60-
}
58+
_ = json.NewEncoder(ctx.Resp).Encode(obj)
6159
}
6260

6361
func apiError(ctx *context.Context, status int, obj any) {
@@ -392,7 +390,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
392390
if isConanfileFile {
393391
metadata, err := conan_module.ParseConanfile(buf)
394392
if err != nil {
395-
log.Error("Error parsing package metadata: %v", err)
396393
apiError(ctx, http.StatusInternalServerError, err)
397394
return
398395
}
@@ -418,7 +415,6 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
418415
} else {
419416
info, err := conan_module.ParseConaninfo(buf)
420417
if err != nil {
421-
log.Error("Error parsing conan info: %v", err)
422418
apiError(ctx, http.StatusInternalServerError, err)
423419
return
424420
}

routers/api/packages/conda/conda.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
packages_model "code.gitea.io/gitea/models/packages"
1414
conda_model "code.gitea.io/gitea/models/packages/conda"
1515
"code.gitea.io/gitea/modules/json"
16-
"code.gitea.io/gitea/modules/log"
1716
packages_module "code.gitea.io/gitea/modules/packages"
1817
conda_module "code.gitea.io/gitea/modules/packages/conda"
1918
"code.gitea.io/gitea/modules/util"
@@ -184,10 +183,7 @@ func EnumeratePackages(ctx *context.Context) {
184183
}
185184

186185
resp.WriteHeader(http.StatusOK)
187-
188-
if err := json.NewEncoder(w).Encode(repoData); err != nil {
189-
log.Error("JSON encode: %v", err)
190-
}
186+
_ = json.NewEncoder(w).Encode(repoData)
191187
}
192188

193189
func UploadPackageFile(ctx *context.Context) {

routers/api/packages/container/auth.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataS
3535

3636
u, err := user_model.GetPossibleUserByID(req.Context(), packageMeta.UserID)
3737
if err != nil {
38-
log.Error("GetPossibleUserByID: %v", err)
3938
return nil, err
4039
}
4140

0 commit comments

Comments
 (0)