From 923d14b7876a17199c45e78399682fea0c0b6922 Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Wed, 20 Jan 2021 14:37:31 +0100 Subject: [PATCH] fix: correctly create decrypted and desktop backups --- app/assets/javascripts/services/archiveManager.ts | 6 +++--- app/assets/javascripts/services/desktopManager.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/services/archiveManager.ts b/app/assets/javascripts/services/archiveManager.ts index eaa800f3e44..0ed5838e747 100644 --- a/app/assets/javascripts/services/archiveManager.ts +++ b/app/assets/javascripts/services/archiveManager.ts @@ -1,5 +1,5 @@ import { WebApplication } from '@/ui_models/application'; -import { EncryptionIntent, ProtectedAction, SNItem, ContentType, SNNote, BackupFile } from '@standardnotes/snjs'; +import { EncryptionIntent, ProtectedAction, ContentType, SNNote, BackupFile, PayloadContent } from '@standardnotes/snjs'; function zippableTxtName(name: string, suffix = ""): string { const sanitizedName = name @@ -116,8 +116,8 @@ export class ArchiveManager { let name, contents; if (item.content_type === ContentType.Note) { const note = item as SNNote; - name = note.title; - contents = note.text; + name = (note.content as PayloadContent).title; + contents = (note.content as PayloadContent).text; } else { name = item.content_type; contents = JSON.stringify(item.content, null, 2); diff --git a/app/assets/javascripts/services/desktopManager.ts b/app/assets/javascripts/services/desktopManager.ts index c7e2d8665ea..62ca519343c 100644 --- a/app/assets/javascripts/services/desktopManager.ts +++ b/app/assets/javascripts/services/desktopManager.ts @@ -189,7 +189,9 @@ export class DesktopManager extends ApplicationService { } async desktop_requestBackupFile() { - const data = this.application!.createBackupFile(EncryptionIntent.FileEncrypted); + const data = await this.application!.createBackupFile( + EncryptionIntent.FileEncrypted + ); if (data) { return JSON.stringify(data, null, 2); }