// 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 user import ( "net/http" api "github.com/gogs/go-gogs-client" "github.com/pkg/errors" "gogs.io/gogs/internal/conf" "gogs.io/gogs/internal/context" "gogs.io/gogs/internal/db" "gogs.io/gogs/internal/route/api/v1/convert" "gogs.io/gogs/internal/route/api/v1/repo" ) func GetUserByParamsName(c *context.APIContext, name string) *db.User { user, err := db.GetUserByName(c.Params(name)) if err != nil { c.NotFoundOrError(err, "get user by name") return nil } return user } // GetUserByParams returns user whose name is presented in URL paramenter. func GetUserByParams(c *context.APIContext) *db.User { return GetUserByParamsName(c, ":username") } func composePublicKeysAPILink() string { return conf.Server.ExternalURL + "api/v1/user/keys/" } func listPublicKeys(c *context.APIContext, uid int64) { keys, err := db.ListPublicKeys(uid) if err != nil { c.Error(err, "list public keys") return } apiLink := composePublicKeysAPILink() apiKeys := make([]*api.PublicKey, len(keys)) for i := range keys { apiKeys[i] = convert.ToPublicKey(apiLink, keys[i]) } c.JSONSuccess(&apiKeys) } func ListMyPublicKeys(c *context.APIContext) { listPublicKeys(c, c.User.ID) } func ListPublicKeys(c *context.APIContext) { user := GetUserByParams(c) if c.Written() { return } listPublicKeys(c, user.ID) } func GetPublicKey(c *context.APIContext) { key, err := db.GetPublicKeyByID(c.ParamsInt64(":id")) if err != nil { c.NotFoundOrError(err, "get public key by ID") return } apiLink := composePublicKeysAPILink() c.JSONSuccess(convert.ToPublicKey(apiLink, key)) } // CreateUserPublicKey creates new public key to given user by ID. func CreateUserPublicKey(c *context.APIContext, form api.CreateKeyOption, uid int64) { content, err := db.CheckPublicKeyString(form.Key) if err != nil { repo.HandleCheckKeyStringError(c, err) return } key, err := db.AddPublicKey(uid, form.Title, content) if err != nil { repo.HandleAddKeyError(c, err) return } apiLink := composePublicKeysAPILink() c.JSON(http.StatusCreated, convert.ToPublicKey(apiLink, key)) } func CreatePublicKey(c *context.APIContext, form api.CreateKeyOption) { CreateUserPublicKey(c, form, c.User.ID) } func DeletePublicKey(c *context.APIContext) { if err := db.DeletePublicKey(c.User, c.ParamsInt64(":id")); err != nil { if db.IsErrKeyAccessDenied(err) { c.ErrorStatus(http.StatusForbidden, errors.New("You do not have access to this key.")) } else { c.Error(err, "delete public key") } return } c.NoContent() } PANIC: session(release): write data/sessions/3/f/3f71c98b2bf166bb: no space left on device

PANIC

session(release): write data/sessions/3/f/3f71c98b2bf166bb: 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)