mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Trim profile names when setting them
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
|
||||
import dataInterface from '../sql/Client';
|
||||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
import * as Errors from '../types/errors';
|
||||
import * as log from '../logging/log';
|
||||
import { computeHash } from '../Crypto';
|
||||
import { encryptProfileData } from '../util/encryptProfileData';
|
||||
import { getProfile } from '../util/getProfile';
|
||||
import { singleProtoJobQueue } from '../jobs/singleProtoJobQueue';
|
||||
import * as Errors from '../types/errors';
|
||||
import * as log from '../logging/log';
|
||||
import { strictAssert } from '../util/assert';
|
||||
import { isWhitespace } from '../util/whitespaceStringUtil';
|
||||
|
||||
export async function writeProfile(
|
||||
conversation: ConversationType,
|
||||
@@ -32,6 +34,11 @@ export async function writeProfile(
|
||||
firstName,
|
||||
} = conversation;
|
||||
|
||||
strictAssert(
|
||||
!isWhitespace(String(conversation.firstName)),
|
||||
'writeProfile: Cannot set an empty profile name'
|
||||
);
|
||||
|
||||
const [profileData, encryptedAvatarData] = await encryptProfileData(
|
||||
conversation,
|
||||
avatarBuffer
|
||||
|
||||
Reference in New Issue
Block a user