mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 09:44:21 +00:00 
			
		
		
		
	Fixes missing avatars in offline mode (#3471)
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						Kim "BKC" Carlbäcker
					
				
			
			
				
	
			
			
			
						parent
						
							9720f90905
						
					
				
				
					commit
					011f128c89
				
			@@ -299,7 +299,9 @@ func (u *User) generateRandomAvatar(e Engine) error {
 | 
			
		||||
	}
 | 
			
		||||
	// NOTICE for random avatar, it still uses id as avatar name, but custom avatar use md5
 | 
			
		||||
	// since random image is not a user's photo, there is no security for enumable
 | 
			
		||||
	u.Avatar = fmt.Sprintf("%d", u.ID)
 | 
			
		||||
	if u.Avatar == "" {
 | 
			
		||||
		u.Avatar = fmt.Sprintf("%d", u.ID)
 | 
			
		||||
	}
 | 
			
		||||
	if err = os.MkdirAll(filepath.Dir(u.CustomAvatarPath()), os.ModePerm); err != nil {
 | 
			
		||||
		return fmt.Errorf("MkdirAll: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user