From b3268496da6db9bddb357c2732e52b1c980fd4de Mon Sep 17 00:00:00 2001 From: ivk Date: Fri, 20 Dec 2024 18:06:19 +0100 Subject: [PATCH] Don't use baseUrl for requesting blob access tokens for files Co-authored-by: paw --- .../api/worker/facades/lazy/MailExportFacade.ts | 3 +-- src/mail-app/native/main/MailExportController.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/common/api/worker/facades/lazy/MailExportFacade.ts b/src/common/api/worker/facades/lazy/MailExportFacade.ts index f6c457bab174..e3bf810be279 100644 --- a/src/common/api/worker/facades/lazy/MailExportFacade.ts +++ b/src/common/api/worker/facades/lazy/MailExportFacade.ts @@ -57,13 +57,12 @@ export class MailExportFacade { return this.mailExportTokenFacade.loadWithToken((token) => this.bulkMailLoader.loadAttachments(mails, { baseUrl, ...this.options(token) })) } - async loadAttachmentData(mail: Mail, attachments: readonly TutanotaFile[], baseUrl: string): Promise { + async loadAttachmentData(mail: Mail, attachments: readonly TutanotaFile[]): Promise { const attachmentsWithKeys = await this.cryptoFacade.enforceSessionKeyUpdateIfNeeded(mail, attachments) const downloads = await this.mailExportTokenFacade.loadWithToken((token) => { const referencingInstances = attachmentsWithKeys.map(createReferencingInstance) return this.blobFacade.downloadAndDecryptBlobsOfMultipleInstances(ArchiveDataType.Attachments, referencingInstances, { - baseUrl, ...this.options(token), }) }) diff --git a/src/mail-app/native/main/MailExportController.ts b/src/mail-app/native/main/MailExportController.ts index 9c117749afb9..b53055dcdbd8 100644 --- a/src/mail-app/native/main/MailExportController.ts +++ b/src/mail-app/native/main/MailExportController.ts @@ -39,7 +39,7 @@ export class MailExportController { private _state: Stream = stream({ type: "idle" }) private _lastExport: Date | null = null private servers?: BlobServerUrl[] - private serverCount: number = 0 + private serverIndex: number = 0 get lastExport(): Date | null { return this._lastExport @@ -181,7 +181,7 @@ export class MailExportController { const mailAttachmentInfo = mail.attachments .map((attachmentId) => attachmentInfo.find((attachment) => isSameId(attachment._id, attachmentId))) .filter(isNotNull) - const attachments = await this.mailExportFacade.loadAttachmentData(mail, mailAttachmentInfo, this.getServerUrl()) + const attachments = await this.mailExportFacade.loadAttachmentData(mail, mailAttachmentInfo) const { makeMailBundle } = await import("../../mail/export/Bundler.js") const mailBundle = makeMailBundle(this.sanitizer, mail, mailDetails, attachments) @@ -228,11 +228,11 @@ export class MailExportController { private getServerUrl(): string { if (this.servers) { - this.serverCount += 1 - if (this.serverCount >= this.servers.length) { - this.serverCount = 0 + this.serverIndex += 1 + if (this.serverIndex >= this.servers.length) { + this.serverIndex = 0 } - return this.servers[this.serverCount].url + return this.servers[this.serverIndex].url } throw new Error("No servers") }