aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/repo.go')
-rw-r--r--routers/web/repo/repo.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go
index 92f74bbf33..70dcbae0e1 100644
--- a/routers/web/repo/repo.go
+++ b/routers/web/repo/repo.go
@@ -312,7 +312,7 @@ const (
// Action response for actions to a repository
func Action(ctx *context.Context) {
var err error
- switch ctx.Params(":action") {
+ switch ctx.PathParam(":action") {
case "watch":
err = repo_model.WatchRepo(ctx, ctx.Doer, ctx.Repo.Repository, true)
case "unwatch":
@@ -340,29 +340,29 @@ func Action(ctx *context.Context) {
if errors.Is(err, user_model.ErrBlockedUser) {
ctx.Flash.Error(ctx.Tr("repo.action.blocked_user"))
} else {
- ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
+ ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.PathParam(":action")), err)
return
}
}
- switch ctx.Params(":action") {
+ switch ctx.PathParam(":action") {
case "watch", "unwatch":
ctx.Data["IsWatchingRepo"] = repo_model.IsWatching(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID)
case "star", "unstar":
ctx.Data["IsStaringRepo"] = repo_model.IsStaring(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID)
}
- switch ctx.Params(":action") {
+ switch ctx.PathParam(":action") {
case "watch", "unwatch", "star", "unstar":
// we have to reload the repository because NumStars or NumWatching (used in the templates) has just changed
ctx.Data["Repository"], err = repo_model.GetRepositoryByName(ctx, ctx.Repo.Repository.OwnerID, ctx.Repo.Repository.Name)
if err != nil {
- ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.Params(":action")), err)
+ ctx.ServerError(fmt.Sprintf("Action (%s)", ctx.PathParam(":action")), err)
return
}
}
- switch ctx.Params(":action") {
+ switch ctx.PathParam(":action") {
case "watch", "unwatch":
ctx.HTML(http.StatusOK, tplWatchUnwatch)
return
@@ -412,8 +412,8 @@ func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
// RedirectDownload return a file based on the following infos:
func RedirectDownload(ctx *context.Context) {
var (
- vTag = ctx.Params("vTag")
- fileName = ctx.Params("fileName")
+ vTag = ctx.PathParam("vTag")
+ fileName = ctx.PathParam("fileName")
)
tagNames := []string{vTag}
curRepo := ctx.Repo.Repository
@@ -460,7 +460,7 @@ func RedirectDownload(ctx *context.Context) {
// Download an archive of a repository
func Download(ctx *context.Context) {
- uri := ctx.Params("*")
+ uri := ctx.PathParam("*")
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, uri)
if err != nil {
if errors.Is(err, archiver_service.ErrUnknownArchiveFormat{}) {
@@ -519,7 +519,7 @@ func download(ctx *context.Context, archiveName string, archiver *repo_model.Rep
// a request that's already in-progress, but the archiver service will just
// kind of drop it on the floor if this is the case.
func InitiateDownload(ctx *context.Context) {
- uri := ctx.Params("*")
+ uri := ctx.PathParam("*")
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, uri)
if err != nil {
ctx.ServerError("archiver_service.NewRequest", err)