mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 09:08:26 +01:00
Fix the repoLenght variable verification
This commit is contained in:
parent
dbcbe80084
commit
802fea6633
@ -107,7 +107,7 @@ func FilterAccess(username string, a *token.ResourceActions) {
|
||||
if a.Type == "repository" {
|
||||
repoSplit := strings.Split(a.Name, "/")
|
||||
repoLength := len(repoSplit)
|
||||
if repoLength > 0 { //Only check the permission when the requested image has a namespace, i.e. project
|
||||
if repoLength > 1 { //Only check the permission when the requested image has a namespace, i.e. project/alpine
|
||||
var projectName string
|
||||
if repoLength > 2 { //If the repo contains more than 1 separation (as privateregistry.local/library/alpine) consider the second item from array (library)
|
||||
projectName = repoSplit[1]
|
||||
|
Loading…
Reference in New Issue
Block a user