aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorOleg Kovalov <iamolegkovalov@gmail.com>2018-10-20 23:25:14 +0200
committertechknowlogick <hello@techknowlogick.com>2018-10-20 17:25:14 -0400
commit5a4648cdd697be92d33be55cd85069365cce2588 (patch)
tree0d246271e482d8d8ffb9f357861c0db5d698064f /modules
parent583b1b84293635633199123ff759849fbd09f7f2 (diff)
downloadgitea-5a4648cdd697be92d33be55cd85069365cce2588.tar.gz
gitea-5a4648cdd697be92d33be55cd85069365cce2588.zip
Remove check for negative length (#5120)
Diffstat (limited to 'modules')
-rw-r--r--modules/auth/auth.go2
-rw-r--r--modules/user/user_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/modules/auth/auth.go b/modules/auth/auth.go
index 8391e7de8f..0d703084da 100644
--- a/modules/auth/auth.go
+++ b/modules/auth/auth.go
@@ -36,7 +36,7 @@ func SignedInID(ctx *macaron.Context, sess session.Store) int64 {
// Check access token.
if IsAPIPath(ctx.Req.URL.Path) {
tokenSHA := ctx.Query("token")
- if len(tokenSHA) <= 0 {
+ if len(tokenSHA) == 0 {
tokenSHA = ctx.Query("access_token")
}
if len(tokenSHA) == 0 {
diff --git a/modules/user/user_test.go b/modules/user/user_test.go
index 51f10dbbd2..ae7460281f 100644
--- a/modules/user/user_test.go
+++ b/modules/user/user_test.go
@@ -18,7 +18,7 @@ func getWhoamiOutput() (string, error) {
func TestCurrentUsername(t *testing.T) {
user := CurrentUsername()
- if len(user) <= 0 {
+ if len(user) == 0 {
t.Errorf("expected non-empty user, got: %s", user)
}
// Windows whoami is weird, so just skip remaining tests