Skip to content

Commit

Permalink
fix: ui test
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanmo226 committed Mar 26, 2024
1 parent f7cb1cc commit 4262aee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 0 additions & 5 deletions extension/js/common/api/email-provider/gmail/gmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,9 @@ export class Gmail extends EmailProviderApi implements EmailProviderInterface {
let completeChunk = '';
while (true) {
const { done, value } = await reader.read();
console.log(done);
console.log(value);
console.log(treatAs);
if (done) break;
const chunk = new TextDecoder().decode(value);
totalBytes += value.length; // Update total bytes based on the Uint8Array length
console.log(totalBytes);
console.log(chunk);
completeChunk += chunk;
if (totalBytes >= minBytes || treatAs === 'publicKey') {
// Process and return the chunk if the conditions are met
Expand Down
10 changes: 9 additions & 1 deletion extension/js/common/message-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,15 @@ export class MessageRenderer {
if (this.debug) {
console.debug('processAttachment() try -> awaiting chunk + awaiting type');
}
const data = await this.downloader.waitForAttachmentChunkDownload(a, treatAs);
let data = await this.downloader.waitForAttachmentChunkDownload(a, treatAs);
// For some reason, it sometimes doesn't return Buf and instead returns object
// Need to convert it to Buf
if (!(data instanceof Buf)) {
const att = Object.entries(data).map(entry => {
return entry[1] as number;
});
data = new Buf(att);
}
const openpgpType = MsgUtil.type({ data });
if (openpgpType && openpgpType.type === 'publicKey' && openpgpType.armored) {
// todo: publicKey attachment can't be too big, so we could do preparePubkey() call (checking file length) right here
Expand Down

0 comments on commit 4262aee

Please sign in to comment.