Normalize UUID in ConversationModel.initialize
This commit is contained in:
parent
f03cf1ba0e
commit
fdbb2bfb36
3 changed files with 22 additions and 6 deletions
|
@ -1,14 +1,17 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { UUIDStringType } from '../types/UUID';
|
||||
import { isValidUuid } from '../types/UUID';
|
||||
import { assert } from './assert';
|
||||
|
||||
export function normalizeUuid(uuid: string, context: string): string {
|
||||
export function normalizeUuid(uuid: string, context: string): UUIDStringType {
|
||||
const result = uuid.toLowerCase();
|
||||
|
||||
assert(
|
||||
isValidUuid(uuid),
|
||||
`Normalizing invalid uuid: ${uuid} in context "${context}"`
|
||||
isValidUuid(uuid) && isValidUuid(result),
|
||||
`Normalizing invalid uuid: ${uuid} to ${result} in context "${context}"`
|
||||
);
|
||||
|
||||
return uuid.toLowerCase();
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue