Skip to content

Commit 76554fe

Browse files
committed
fix test
1 parent ce73234 commit 76554fe

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

routers/api/packages/arch/arch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func refreshLocker(ctx *context.Context, group string) (globallock.ReleaseFunc,
4747
}
4848

4949
func PushPackage(ctx *context.Context) {
50-
group := ctx.PathParam("*")
50+
group := strings.Trim(ctx.PathParam("*"), "/")
5151
releaser, err := refreshLocker(ctx, group)
5252
if err != nil {
5353
apiError(ctx, http.StatusInternalServerError, err)

tests/integration/api_packages_arch_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"code.gitea.io/gitea/models/unittest"
2424
user_model "code.gitea.io/gitea/models/user"
2525
arch_model "code.gitea.io/gitea/modules/packages/arch"
26+
"code.gitea.io/gitea/modules/util"
2627
"code.gitea.io/gitea/tests"
2728

2829
"github.com/ProtonMail/go-crypto/openpgp/armor"
@@ -133,10 +134,7 @@ HMhNSS1IzUsBcpJAPFAwwUXSM0u4BjoaR8EoGAWjgGQAAILFeyQADAAA
133134
})
134135

135136
for _, group := range []string{"", "arch", "arch/os", "x86_64"} {
136-
groupURL := rootURL
137-
if group != "" {
138-
groupURL = groupURL + "/" + group
139-
}
137+
groupURL := rootURL + util.Iif(group == "", "", "/"+group)
140138
t.Run(fmt.Sprintf("Upload[%s]", group), func(t *testing.T) {
141139
defer tests.PrintCurrentTest(t)()
142140

@@ -314,7 +312,9 @@ HMhNSS1IzUsBcpJAPFAwwUXSM0u4BjoaR8EoGAWjgGQAAILFeyQADAAA
314312
MakeRequest(t, req, http.StatusNoContent)
315313
})
316314
}
315+
require.False(t, t.Failed())
317316
}
317+
318318
t.Run("Concurrent Upload", func(t *testing.T) {
319319
defer tests.PrintCurrentTest(t)()
320320
var wg sync.WaitGroup

0 commit comments

Comments
 (0)