Browse Source

fix-2370

tags/v1.22.7.2^2
ychao_1983 3 years ago
parent
commit
9d42e312d7
2 changed files with 15 additions and 0 deletions
  1. +14
    -0
      routers/repo/cloudbrain.go
  2. +1
    -0
      routers/routes/routes.go

+ 14
- 0
routers/repo/cloudbrain.go View File

@@ -865,6 +865,20 @@ func CloudBrainCommitImageShow(ctx *context.Context) {
ctx.HTML(200, tplCloudBrainImageSubmit)
}

func GetImage(ctx *context.Context) {

var ID = ctx.Params(":id")
id, _ := strconv.ParseInt(ID, 10, 64)

image, err := models.GetImageByID(id)
if err != nil {
log.Error("GetImageByID failed:%v", err.Error())
ctx.JSON(http.StatusNotFound, nil)
}
ctx.JSON(http.StatusOK, image)

}

func CloudBrainImageEdit(ctx *context.Context) {
ctx.Data["PageIsImageEdit"] = true
ctx.Data["PageFrom"] = ctx.Params(":from")


+ 1
- 0
routers/routes/routes.go View File

@@ -1016,6 +1016,7 @@ func RegisterRoutes(m *macaron.Macaron) {
}, context.RepoAssignment(), context.RepoMustNotBeArchived(), reqRepoAdmin)

m.Group("/image/:id", func() {
m.Get("", repo.GetImage)
m.Get("/:from", cloudbrain.AdminOrImageCreaterRight, repo.CloudBrainImageEdit)
m.Post("", cloudbrain.AdminOrImageCreaterRight, bindIgnErr(auth.EditImageCloudBrainForm{}), repo.CloudBrainImageEditPost)
m.Delete("", cloudbrain.AdminOrImageCreaterRight, repo.CloudBrainImageDelete)


Loading…
Cancel
Save