Explorar el Código

routes/user/setting: fix avatar email update error (#5245)

Wei He hace 6 años
padre
commit
73dbaefec5
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      routes/user/setting.go

+ 1 - 1
routes/user/setting.go

@@ -119,7 +119,7 @@ func UpdateAvatarSetting(c *context.Context, f form.Avatar, ctxUser *models.User
 		ctxUser.AvatarEmail = f.Gravatar
 	}
 
-	if f.Avatar != nil {
+	if f.Avatar != nil && f.Avatar.Filename != "" {
 		r, err := f.Avatar.Open()
 		if err != nil {
 			return fmt.Errorf("Avatar.Open: %v", err)