Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 3df6be9

Browse files
committed
Convert country and region to lowercase for comparison
1 parent a5c8386 commit 3df6be9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/common/src/constraints/ValidityChecks.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,16 @@ export const checkSanctionedGeoArea = async (
451451
candidate.name,
452452
);
453453
if (location && location.region && location.country) {
454-
const sanctionedCountries = config.constraints?.sanctionedCountries;
455-
const sanctionedRegions = config.constraints?.sanctionedRegions;
454+
const sanctionedCountries = config.constraints?.sanctionedCountries.map(
455+
(x) => x.trim().toLowerCase(),
456+
);
457+
const sanctionedRegions = config.constraints?.sanctionedRegions.map((x) =>
458+
x.trim().toLowerCase(),
459+
);
460+
456461
if (
457-
sanctionedCountries.includes(location.country.trim().toUpperCase()) ||
458-
sanctionedRegions.includes(
459-
location.region.trim().charAt(0).toUpperCase() +
460-
location.region.trim().slice(1).toLowerCase(),
461-
)
462+
sanctionedCountries.includes(location.country.trim().toLowerCase()) ||
463+
sanctionedRegions.includes(location.region.trim().toLowerCase())
462464
) {
463465
logger.info(
464466
`${candidate.name} is in a sanctioned location: Country: ${location.country}, Region: ${location.region}`,

0 commit comments

Comments
 (0)