mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	Using strings.HasPrefix(...) will misjudgement
`strings.HasPrefix(access.RepoName, uname)` can't handle the situation which like following in access table. user_name | repo_name ----------+------------- toby | toby/blog toby | toby/test toby | tobyzxj/blog toby | tobyzxj/test
This commit is contained in:
		@@ -831,11 +831,11 @@ func GetCollaborativeRepos(uname string) ([]*Repository, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	repos := make([]*Repository, 0, 10)
 | 
						repos := make([]*Repository, 0, 10)
 | 
				
			||||||
	for _, access := range accesses {
 | 
						for _, access := range accesses {
 | 
				
			||||||
		if strings.HasPrefix(access.RepoName, uname) {
 | 
							infos := strings.Split(access.RepoName, "/")
 | 
				
			||||||
 | 
							if infos[0] == uname {
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		infos := strings.Split(access.RepoName, "/")
 | 
					 | 
				
			||||||
		u, err := GetUserByName(infos[0])
 | 
							u, err := GetUserByName(infos[0])
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user