summaryrefslogtreecommitdiffstats
path: root/models/token.go
diff options
context:
space:
mode:
authorFranz Schmidt <valsatize@gmail.com>2016-06-27 11:02:39 +0200
committer无闻 <u@gogs.io>2016-06-27 17:02:39 +0800
commit8b35c194ecf5ff44a0b80595a5631e76e14fd0fb (patch)
tree2efcf19f367848d317ae20685db26ae352b2f2c4 /models/token.go
parentac05f886413bb5f2ca97b9af8ad5209619c138c0 (diff)
downloadgitea-8b35c194ecf5ff44a0b80595a5631e76e14fd0fb.tar.gz
gitea-8b35c194ecf5ff44a0b80595a5631e76e14fd0fb.zip
Fixes #3110 (#3136)
Diffstat (limited to 'models/token.go')
-rw-r--r--models/token.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/token.go b/models/token.go
index 38d83e2172..d015d97aa6 100644
--- a/models/token.go
+++ b/models/token.go
@@ -56,6 +56,9 @@ func NewAccessToken(t *AccessToken) error {
// GetAccessTokenBySHA returns access token by given sha1.
func GetAccessTokenBySHA(sha string) (*AccessToken, error) {
+ if sha == "" {
+ return nil, ErrAccessTokenEmpty{}
+ }
t := &AccessToken{Sha1: sha}
has, err := x.Get(t)
if err != nil {