mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
fix: no more repeated character ''' in the same character class
This commit is contained in:
@@ -138,7 +138,7 @@ class TmdbPersonMapper extends ExternalAPI {
|
||||
const cleanArtistName = artistName
|
||||
.split(/(?:(?:feat|ft)\.?\s+|&\s*|,\s+)/i)[0]
|
||||
.trim()
|
||||
.replace(/['']/g, "'");
|
||||
.replace(/['′']/g, "'");
|
||||
|
||||
const searchResults = await this.get<TmdbSearchPersonResponse>(
|
||||
'/search/person',
|
||||
@@ -151,22 +151,19 @@ class TmdbPersonMapper extends ExternalAPI {
|
||||
this.CACHE_TTL
|
||||
);
|
||||
|
||||
const exactMatches = searchResults.results.filter((person) => {
|
||||
const normalizedPersonName = person.name
|
||||
const normalizeName = (name: string): string => {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.normalize('NFKD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/['']/g, "'")
|
||||
.replace(/['′']/g, "'")
|
||||
.replace(/[^a-z0-9\s]/g, '')
|
||||
.trim();
|
||||
};
|
||||
|
||||
const normalizedArtistName = cleanArtistName
|
||||
.toLowerCase()
|
||||
.normalize('NFKD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/['']/g, "'")
|
||||
.replace(/[^a-z0-9\s]/g, '')
|
||||
.trim();
|
||||
const exactMatches = searchResults.results.filter((person) => {
|
||||
const normalizedPersonName = normalizeName(person.name);
|
||||
const normalizedArtistName = normalizeName(cleanArtistName);
|
||||
|
||||
return normalizedPersonName === normalizedArtistName;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user