Skip to content

Commit

Permalink
Merge pull request #441 from BaseAdresseNationale/antoineludeau/fix-g…
Browse files Browse the repository at this point in the history
…enerated-legacyCommonToponymId-with-hash-method

Fix generated legacyCommonToponymId with sliced sha256 hash
  • Loading branch information
antoineludeau authored Jul 2, 2024
2 parents 6b3c672 + 98de88b commit 8144be1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/api/consumers/format-to-legacy-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const formatCommonToponymDataForLegacy = (commonToponym, district, pseudo
legacyCommonToponymId = `${cog}_${pseudoCodeVoieGenerator.getCode(legacyLabelValue, codeAncienneCommune)}`.toLowerCase()
// If the pseudo code is already used, we generate a new one with a hash from the common toponym id
if (commonToponymLegacyIDSet.has(legacyCommonToponymId)) {
legacyCommonToponymId = `${cog}_${createHmac('sha256', 'ban').update(id).digest('hex').slice(0, 5)}`
legacyCommonToponymId = `${cog}_${createHmac('sha256', 'ban').update(id).digest('hex').slice(0, 6)}`
}
}

Expand Down

0 comments on commit 8144be1

Please sign in to comment.