Extract inline images into attachments for plain rich text messages#3256
Extract inline images into attachments for plain rich text messages#3256
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@tomholub it works now, thanks! Sometimes a good question is better than the advice :) I'll continue working on figuring out why some tests are failing as well as writing a test for this fix. Question: in |
|
Another question: I noticed there was There are still some I guess we should also do |
|
Well noticed! Agree gree that would be a separate pr
Have to look at the other question later when on pc
…On Thu, 17 Dec 2020, 11:11 Limon Monte, ***@***.***> wrote:
Another question: I noticed there was Att -> Attachment renaming recently.
There are still some /Att[A-Z]/ occurrences and I'm using
Mime.createAttNode()
[image: image]
<https://user-images.githubusercontent.com/6059356/102473941-b739f900-4060-11eb-8ad6-e5f10c5f0ed3.png>
I guess we should also do /Att[A-Z]/ -> /Attachment$1/, if so I'd prefer
it to be done in separate PR not to mix the fix and the refactoring in one
PR.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3256 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQDZEIAW4ZDMCVZMDKSDGDSVHKNPANCNFSM4U6VPZ7A>
.
|
extension/js/common/core/mime.ts
Outdated
| return node; | ||
| } | ||
|
|
||
| private static extractInlineImagesToAttachments = (html: string, rootNode: any) => { |
There was a problem hiding this comment.
Looks good in high-level overview 👍 but will need to give this more scrutiny later.
There was a problem hiding this comment.
@seisvelas should scrutinize it for attack vectors if any
41a3be6 to
f896c36
Compare
|
@tomholub do you maybe have any quick guess why the test is failing, there's no |
Sorry haven't been able to have a look yet, can't think of anything without investigating Except if the img got sanitized away somewhere using Xss class |
Thanks, I'll investigate further. |
|
@tomholub I need your help with writing a test. There's I guess something is happening mocked google endpoints, but I can't figure out what and where. Let me know if you have time for helping me with this, if not, then I'll continue debugging it by myself. |
|
Sorry, I only do light work this week so may take a bit of time before I get to this with meaningful help. @rrrooommmaaa - if you have the time - could you look into this? |
Thanks, I realized that from your GitHub activity :) @rrrooommmaaa no need for help atm, I think I'll finish this by myself. I'll let you know additionally if the help will be needed here. |
Found the reason:
|
|
@tomholub the PR is ready for review 🚀 @seisvelas please evaluate the security of the Thanks! |
tomholub
left a comment
There was a problem hiding this comment.
Looks good! It seems that FlowCrypt itself cannot render such messages yet? We may want to look into that sometime, when using Settings -> Inbox.
| expect(sentMsg.payload?.body?.data).to.match(/<img src="cid:(.+)@flowcrypt">This is an automated puppeteer test: Test Sending Plain Message With Image/); | ||
| return; | ||
| // todo - this test case is a stop-gap. We need to implement rendering of such messages below, | ||
| // then let test plain messages with images in them (referenced by cid) just like other types of messages below |
There was a problem hiding this comment.
I'll make an issue for this
| } | ||
| if (choices.richtext && !choices.encrypt && !choices.sign && msg.body['text/html']) { | ||
| // extract inline images of plain rich-text messages (#3256) | ||
| // todo - also apply to rich text signed-only messages |
There was a problem hiding this comment.
Also todo here for later

Fixes #2460
TODO: