From 4539a178c54f1f100f38f732be280d18b440e67c Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Tue, 16 Apr 2024 17:40:41 +0200 Subject: [PATCH] Don't put empty username into backup --- ts/services/backups/export.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ts/services/backups/export.ts b/ts/services/backups/export.ts index 23dd3c6f60db..4c0edbe13c0e 100644 --- a/ts/services/backups/export.ts +++ b/ts/services/backups/export.ts @@ -335,15 +335,19 @@ export class BackupExportStream extends Readable { throw missingCaseError(rawPhoneNumberSharingMode); } + const usernameLink = storage.get('usernameLink'); + return { profileKey: storage.get('profileKey'), - username: me.get('username'), - usernameLink: { - ...(storage.get('usernameLink') ?? {}), + username: me.get('username') || null, + usernameLink: usernameLink + ? { + ...usernameLink, - // Same numeric value, no conversion needed - color: storage.get('usernameLinkColor'), - }, + // Same numeric value, no conversion needed + color: storage.get('usernameLinkColor'), + } + : null, givenName: me.get('profileName'), familyName: me.get('profileFamilyName'), avatarUrlPath: storage.get('avatarUrl'),