aboutsummaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/access.go b/models/access.go
index 4f944517ed..4a202dc6bc 100644
--- a/models/access.go
+++ b/models/access.go
@@ -60,6 +60,9 @@ func UpdateAccessWithSession(sess *xorm.Session, access *Access) error {
// HasAccess returns true if someone can read or write to given repository.
// The repoName should be in format <username>/<reponame>.
func HasAccess(uname, repoName string, mode int) (bool, error) {
+ if len(repoName) == 0 {
+ return false, nil
+ }
access := &Access{
UserName: strings.ToLower(uname),
RepoName: strings.ToLower(repoName),