// Copyright 2015 The Gogs Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package repo import ( "fmt" api "github.com/gogits/go-gogs-client" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/api/v1/convert" ) func composeDeployKeysAPILink(repoPath string) string { return setting.AppUrl + "api/v1/repos/" + repoPath + "/keys/" } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys func ListDeployKeys(ctx *context.APIContext) { keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID) if err != nil { ctx.Error(500, "ListDeployKeys", err) return } apiLink := composeDeployKeysAPILink(ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name) apiKeys := make([]*api.DeployKey, len(keys)) for i := range keys { if err = keys[i].GetContent(); err != nil { ctx.Error(500, "GetContent", err) return } apiKeys[i] = convert.ToDeployKey(apiLink, keys[i]) } ctx.JSON(200, &apiKeys) } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key func GetDeployKey(ctx *context.APIContext) { key, err := models.GetDeployKeyByID(ctx.ParamsInt64(":id")) if err != nil { if models.IsErrDeployKeyNotExist(err) { ctx.Status(404) } else { ctx.Error(500, "GetDeployKeyByID", err) } return } if err = key.GetContent(); err != nil { ctx.Error(500, "GetContent", err) return } apiLink := composeDeployKeysAPILink(ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name) ctx.JSON(200, convert.ToDeployKey(apiLink, key)) } func HandleCheckKeyStringError(ctx *context.APIContext, err error) { if models.IsErrKeyUnableVerify(err) { ctx.Error(422, "", "Unable to verify key content") } else { ctx.Error(422, "", fmt.Errorf("Invalid key content: %v", err)) } } func HandleAddKeyError(ctx *context.APIContext, err error) { switch { case models.IsErrKeyAlreadyExist(err): ctx.Error(422, "", "Key content has been used as non-deploy key") case models.IsErrKeyNameAlreadyUsed(err): ctx.Error(422, "", "Key title has been used") default: ctx.Error(500, "AddKey", err) } } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#add-a-new-deploy-key func CreateDeployKey(ctx *context.APIContext, form api.CreateKeyOption) { content, err := models.CheckPublicKeyString(form.Key) if err != nil { HandleCheckKeyStringError(ctx, err) return } key, err := models.AddDeployKey(ctx.Repo.Repository.ID, form.Title, content) if err != nil { HandleAddKeyError(ctx, err) return } key.Content = content apiLink := composeDeployKeysAPILink(ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name) ctx.JSON(201, convert.ToDeployKey(apiLink, key)) } // https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key func DeleteDeploykey(ctx *context.APIContext) { if err := models.DeleteDeployKey(ctx.User, ctx.ParamsInt64(":id")); err != nil { if models.IsErrKeyAccessDenied(err) { ctx.Error(403, "", "You do not have access to this key") } else { ctx.Error(500, "DeleteDeployKey", err) } return } ctx.Status(204) } PANIC: session(release): write data/sessions/1/5/15d2aa4f7e8cdb75: no space left on device

PANIC

session(release): write data/sessions/1/5/15d2aa4f7e8cdb75: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)