Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger] Fix transporting non-UTF8 payloads by encoding them using base 64#39970

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.4fromnicolas-grekas:messenger-non-utf8
Jan 25, 2021

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedJan 25, 2021
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#33913
LicenseMIT
Doc PR-

Replaces#33920

When using the Doctrine transport, sending emails with binary attachments currently requires a custom Messenger serializer because the "body" column is created for UTF-8 only.

In#33920, it is proposed to change the TEXT type to a BLOB. It leaves at least one problem unhandled: the conversion of existing messenger tables.

This PR takes a more conservative approach, by encoding messages to base 64, only if they are non-UTF8.

Compatibility with the existing format is preserved.

The drawback of this approach is that the size of eg email attachments is going to increase by 33% because of the extra encoding. I think this drawback is acceptable for 4.4, and that this PR is the most pragmatic way to make attachments just work.

bocharsky-bw reacted with heart emoji
@rimas-kudelis
Copy link

rimas-kudelis commentedJan 25, 2021
edited
Loading

The drawback of this approach is that the size of eg email attachments is going to increase by 33% because of the extra encoding. I think this drawback is acceptable for 4.4, and that this PR is the most pragmatic way to make attachments just work.

When you wrote this, did you mean it will increase the size of our messages in the storage, or did you refer to emails that are later sent out? From the code it looks like the former, but your comment almost implies the latter.

@nicolas-grekas
Copy link
MemberAuthor

it will increase the size of our messages in the storage

yes, that's what I meant.

rimas-kudelis reacted with thumbs up emoji

thrownewMessageDecodingFailedException('Encoded envelope should have at least a "body".');
}

if (false ===strpos($encodedEnvelope['body'],'}', -1)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Isn't this check a bit errorprone, what about wrapping the base64 encoded content or prefix it with a special key which we can check against later when retrieving the message?

Copy link
MemberAuthor

@nicolas-grekasnicolas-grekasJan 25, 2021
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think it's error-prone: the php serialization format is likely more stable than this very class.

OskarStark reacted with thumbs up emoji
@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit43eb050 intosymfony:4.4Jan 25, 2021
@nicolas-grekasnicolas-grekas deleted the messenger-non-utf8 branchJanuary 27, 2021 12:53
This was referencedJan 27, 2021
@sroze
Copy link
Contributor

Nice change@nicolas-grekas !

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@fabpotfabpotfabpot approved these changes

@jderussejderussejderusse approved these changes

@srozesrozeAwaiting requested review from sroze

@weaverryanweaverryanAwaiting requested review from weaverryan

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

7 participants

@nicolas-grekas@rimas-kudelis@fabpot@sroze@jderusse@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp