Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Set content id of attachments #597

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davvil
Copy link

@davvil davvil commented Nov 14, 2018

The Content-ID is set to the file name.

In this way, when composing HTML message inline images can be included. E.g. when editing markup

![This is an inline image](cid:image.jpg)

will include image.jpg in the text. AFAIK there was no easy way to inline attached images before.

As this happens at send time, the preview will not display the image, though.

@gauteh
Copy link
Member

gauteh commented Nov 15, 2018 via email

@davvil davvil changed the title Set content id of attachments [WIP] Set content id of attachments Nov 16, 2018
@davvil
Copy link
Author

davvil commented Nov 16, 2018

I was actually surprised that it should be so easy...

I checked the rfc and actually the cid should be "globally unique". This could be accomplished e.g. by appending the message id to the file name, with an @-symbol as separator. But then the simple inlining will not work anymore without modifying the reference with the new cid. That being said, apparently this rule is not strictly followed. I actually took the "cid is filename" convetion from some mails that I have received. You can also look at this thread in stackoverflow. But I think we should follow the standard.

One thing that could ease the implementation of the name substitution, without having to parse the full markdown or html, is to define our own convention for indicating an inline image and do a simple substitution each time we encounter the prefix, e.g. specify ![caption](#@inline:image.jpg), but of course this could produce undesired substitutions in some edge cases. Is it possible with webkit to get a list of all the references in a document?

As for displaying the image in the preview, I haven't looked at the code yet. I'll try to get it working.

@davvil
Copy link
Author

davvil commented Nov 16, 2018

BTW. What is your preference for PRs? I marked this one as [WIP] as it is clearly not ready for merging. Is this OK or do you prefer that I close it and create a new one when it is more mature?

@gauteh
Copy link
Member

gauteh commented Nov 16, 2018 via email

@gauteh
Copy link
Member

gauteh commented Nov 16, 2018 via email

@davvil
Copy link
Author

davvil commented Nov 16, 2018 via email

@gauteh
Copy link
Member

gauteh commented Nov 16, 2018 via email

@davvil
Copy link
Author

davvil commented Nov 16, 2018 via email

@gauteh
Copy link
Member

gauteh commented Nov 16, 2018 via email

@davvil
Copy link
Author

davvil commented Nov 16, 2018 via email

@gauteh
Copy link
Member

gauteh commented Nov 16, 2018 via email

@davvil
Copy link
Author

davvil commented Nov 16, 2018 via email

@gauteh
Copy link
Member

gauteh commented Jan 2, 2019

Is this one ready for review? Or are you still working on it?

@davvil
Copy link
Author

davvil commented Jan 4, 2019 via email

@gauteh gauteh mentioned this pull request Apr 4, 2019
@ff2000
Copy link
Contributor

ff2000 commented Feb 20, 2020

Just an idea: Why not generate a new message id for the cid everytime a file gets attached? The postfix of the cid will differ from the actual mid only in the timestamp, but sending a mail should result in unique mids at any point in time, so the cid should also be unique with this approach.
Replying to a message with attachments could be done the same: Generate a message id when the user hits "reply" and just use that.

@gauteh
Copy link
Member

gauteh commented May 11, 2020

I think that's ok, but it should be easy to refer to those cid's in a markdown email. It might be difficult to guess those when auto-generated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants