mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:39:37 -05:00 
			
		
		
		
	fix(server): do not leak people (#4710)
This commit is contained in:
		
							parent
							
								
									512f672e9e
								
							
						
					
					
						commit
						cc3149c520
					
				@ -103,15 +103,18 @@ export class PersonRepository implements IPersonRepository {
 | 
				
			|||||||
    return this.personRepository.findOne({ where: { id: personId } });
 | 
					    return this.personRepository.findOne({ where: { id: personId } });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  getByName(userId: string, personName: string, { withHidden }: PersonNameSearchOptions): Promise<PersonEntity[]> {
 | 
					  async getByName(
 | 
				
			||||||
 | 
					    userId: string,
 | 
				
			||||||
 | 
					    personName: string,
 | 
				
			||||||
 | 
					    { withHidden }: PersonNameSearchOptions,
 | 
				
			||||||
 | 
					  ): Promise<PersonEntity[]> {
 | 
				
			||||||
    const queryBuilder = this.personRepository
 | 
					    const queryBuilder = this.personRepository
 | 
				
			||||||
      .createQueryBuilder('person')
 | 
					      .createQueryBuilder('person')
 | 
				
			||||||
      .leftJoin('person.faces', 'face')
 | 
					      .leftJoin('person.faces', 'face')
 | 
				
			||||||
      .where('person.ownerId = :userId', { userId })
 | 
					      .where(
 | 
				
			||||||
      .andWhere('LOWER(person.name) LIKE :nameStart OR LOWER(person.name) LIKE :nameAnywhere', {
 | 
					        'person.ownerId = :userId AND (LOWER(person.name) LIKE :nameStart OR LOWER(person.name) LIKE :nameAnywhere)',
 | 
				
			||||||
        nameStart: `${personName.toLowerCase()}%`,
 | 
					        { userId, nameStart: `${personName.toLowerCase()}%`, nameAnywhere: `% ${personName.toLowerCase()}%` },
 | 
				
			||||||
        nameAnywhere: `% ${personName.toLowerCase()}%`,
 | 
					      )
 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      .groupBy('person.id')
 | 
					      .groupBy('person.id')
 | 
				
			||||||
      .orderBy('COUNT(face.assetId)', 'DESC')
 | 
					      .orderBy('COUNT(face.assetId)', 'DESC')
 | 
				
			||||||
      .limit(20);
 | 
					      .limit(20);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user