Use untagged pnis in storage service
This commit is contained in:
parent
283ef57779
commit
eb7942dd1e
16 changed files with 530 additions and 62 deletions
|
@ -49,6 +49,10 @@ export function toTaggedPni(untagged: UntaggedPniString): PniString {
|
|||
return `PNI:${untagged}` as PniString;
|
||||
}
|
||||
|
||||
export function toUntaggedPni(pni: PniString): UntaggedPniString {
|
||||
return pni.replace(/^PNI:/i, '') as UntaggedPniString;
|
||||
}
|
||||
|
||||
export function normalizeServiceId(
|
||||
rawServiceId: string,
|
||||
context: string,
|
||||
|
@ -106,10 +110,9 @@ export function normalizePni(
|
|||
}
|
||||
|
||||
const result = rawPni.toLowerCase().replace(/^pni:/, 'PNI:');
|
||||
|
||||
if (!isPniString(result)) {
|
||||
logger.warn(
|
||||
`Normalizing invalid serviceId: ${rawPni} to ${result} in context "${context}"`
|
||||
`Normalizing invalid pni: ${rawPni} to ${result} in context "${context}"`
|
||||
);
|
||||
|
||||
// Cast anyway we don't want to throw here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue