Open limonte opened 3 years ago
Quick investigation, Gmail API returns 413:
Request Entity Too Large: 413 when POST-ing https://www.googleapis.com/upload/gmail/v1/users/me/messages/send?uploadType=multipart string: not-a-json -> Media is too large. Limit: 36700160"
Interestingly, the size of the encrypted message is different in Chrome and Firefox:
data.length = 45566914
data.length = 85886178
Almost twice bigger in Firefox for the same message from the issue description.
This is very interesting
Assigning Ivan to sometime later investigate why would Firefox produce larger messages.
@limonte @tomholub I could not reproduce this. I have latest Firefox 94.0 on Ubuntu 20.04 LTS. I've sent email from "Flowcrypt Compatibility" to myself with 4 copies of that attached w/o issue. email ref: https://mail.google.com/mail/u/2/#sent/WhctKKXHDWpPWprJNGpkDqJcgrMMVkBLnnMNSDDfBGMkNtHVwKVzGnxTkwzzkMBPpXGlKqg
My bad here, sorry for wasting your time @IvanPizhenko
When reporting the issue I didn't notice the enabled "Rich text (PGP/MIME) - experimental":
So, the issue is actually "Rich text (PGP/MIME) - experimental" produces twice bigger request body. After this line https://github.com/FlowCrypt/flowcrypt-browser/blob/master/extension/js/common/api/email-provider/gmail/gmail.ts#L91 console.log(request.body.length)
logs:
85885878
when "Rich text (PGP/MIME) - experimental" enabled45561782
when "Rich text (PGP/MIME) - experimental" disabledThank you both.
There is indeed some inefficiency in how we encode attachments with PGP/MIME. They are too big. I'm not exactly sure what it is - probably using a base64 somewhere where a binary representation would do, and maybe more than once.
I'm not too keen on trying to fix it until Google fixes this bug in Gmail API: #3157
Here's what I'm getting when I try to send encrypted message with 4 large CSV files:
In Chrome I am able to send the exact same message.
All CSV files are the copy of this file: 50000.Sales.Records.csv