mirror of https://github.com/go-gitea/gitea.git
fix bugs from forgejo
This commit is contained in:
parent
ce73234b42
commit
f68456febe
|
@ -165,6 +165,12 @@ func PushPackage(ctx *context.Context) {
|
|||
apiError(ctx, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
if p.FileMetadata.Arch == "any" {
|
||||
if err = arch_service.BuildCustomRepositoryFiles(ctx, ctx.Package.Owner.ID, group); err != nil {
|
||||
apiError(ctx, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.Status(http.StatusCreated)
|
||||
}
|
||||
|
||||
|
|
|
@ -285,6 +285,14 @@ func GetPackageDBFile(ctx context.Context, group, arch string, ownerID int64, si
|
|||
fileName = fmt.Sprintf("%s.db.sig", arch)
|
||||
}
|
||||
file, err := packages_model.GetFileForVersionByName(ctx, pv.ID, fileName, group)
|
||||
// failback to any db
|
||||
if errors.Is(err, util.ErrNotExist) && arch != "any" {
|
||||
fileName = "any.db"
|
||||
if signFile {
|
||||
fileName = "any.db.sig"
|
||||
}
|
||||
file, err = packages_model.GetFileForVersionByName(ctx, pv.ID, fileName, group)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
|
|
@ -336,6 +336,30 @@ HMhNSS1IzUsBcpJAPFAwwUXSM0u4BjoaR8EoGAWjgGQAAILFeyQADAAA
|
|||
MakeRequest(t, req, http.StatusNoContent)
|
||||
}
|
||||
})
|
||||
t.Run("Package Arch Test", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
req := NewRequestWithBody(t, "PUT", rootURL, bytes.NewReader(pkgs["any"])).
|
||||
AddBasicAuth(user.Name)
|
||||
MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
req = NewRequest(t, "GET", rootURL+"/x86_64/base.db")
|
||||
respPkg := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
files, err := listTarGzFiles(respPkg.Body.Bytes())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, files, 1)
|
||||
|
||||
req = NewRequestWithBody(t, "PUT", rootURL, bytes.NewReader(pkgs["otherXZ"])).
|
||||
AddBasicAuth(user.Name)
|
||||
MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
req = NewRequest(t, "GET", rootURL+"/x86_64/base.db")
|
||||
respPkg = MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
files, err = listTarGzFiles(respPkg.Body.Bytes())
|
||||
require.NoError(t, err)
|
||||
require.Len(t, files, 2)
|
||||
})
|
||||
}
|
||||
|
||||
func getProperty(data, key string) string {
|
||||
|
|
Loading…
Reference in New Issue