1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor context RefName and RepoAssignment (#33226)

The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of
ambiguity.

This PR does some refactoring and use `RefFullName` to replace the
legacy `RefName`, and simplify RepoAssignment
This commit is contained in:
wxiaoguang
2025-01-13 09:07:05 +08:00
committed by GitHub
parent 604365efd7
commit 81352542fd
20 changed files with 187 additions and 219 deletions

View File

@@ -17,11 +17,11 @@ func DownloadArchive(ctx *context.APIContext) {
var tp git.ArchiveType
switch ballType := ctx.PathParam("ball_type"); ballType {
case "tarball":
tp = git.TARGZ
tp = git.ArchiveTarGz
case "zipball":
tp = git.ZIP
tp = git.ArchiveZip
case "bundle":
tp = git.BUNDLE
tp = git.ArchiveBundle
default:
ctx.Error(http.StatusBadRequest, "", fmt.Sprintf("Unknown archive type: %s", ballType))
return
@@ -36,7 +36,7 @@ func DownloadArchive(ctx *context.APIContext) {
}
}
r, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, ctx.PathParam("*"), tp)
r, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, ctx.PathParam("*")+"."+tp.String())
if err != nil {
ctx.ServerError("NewRequest", err)
return