8000 [Mime] Fix embed logic for background attributes by flack · Pull Request #45376 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mime] Fix embed logic for background attributes #45376

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

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Conversation

flack
Copy link
Contributor
@flack flack commented Feb 9, 2022
Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #42921
License MIT
Doc PR

As suggested by @fabpot here #43255 (comment), this is the most minimal fix for the linked issue. I guess the same problem can happen if you use e.g.

<div style="background-image:url(cid:test.gif)"></div>

I have changed it so that there is now an array of regexes to look for embedded images, so at least code for the background-image case (or others that might be found later on) can easily be added.

@@ -329,7 +329,7 @@ public function testGenerateBody()
$generatedHtml = $parts[0]->getParts()[1];
$this->assertStringContainsString('cid:'.$parts[1]->getContentId(), $generatedHtml->getBody());

$content = 'html content <img src="cid:test.gif">';
$content = '<div background="cid:test.gif"></div>';
Copy link
Member

Choose a reason for hiding this comment

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

Can you add new tests instead of modifying existing ones?

@flack
Copy link
Contributor Author
flack commented Feb 9, 2022

There's a coding style violation that wants me to add a trailing comma in the regex array. AFAIK that is only supported on PHP 7.3+, so it'll probably cause CI to fail. Should I still do it?

@flack
Copy link
Contributor Author
flack commented Feb 9, 2022

also, what is your policy with implementing review comments, should I make new commits or squash immediately?

@flack
Copy link
Contributor Author
flack commented Feb 9, 2022

implemented review comments (except for the trailing comma one, see above)

@derrabus
Copy link
Member
derrabus commented Feb 9, 2022

There's a coding style violation that wants me to add a trailing comma in the regex array. AFAIK that is only supported on PHP 7.3+, so it'll probably cause CI to fail. Should I still do it?

Trailing commas in array constructors are allowed in PHP 7.1 already, no worries.

@derrabus
Copy link
Member
derrabus commented Feb 9, 2022

also, what is your policy with implementing review comments, should I make new commits or squash immediately?

As you wish, we can squash while merging.

@flack
Copy link
Contributor Author
flack commented Feb 9, 2022

alright, thx. All suggestions should be implemented now

@carsonbot carsonbot changed the title Fix embed logic for background attributes [Mime] Fix embed logic for background attributes Feb 9, 2022
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Feb 9, 2022
@fabpot
Copy link
Member
fabpot commented Feb 10, 2022

I'm merging it in 6.1 as this is a new feature (this was not supported before).

@fabpot fabpot modified the milestones: 4.4, 6.1 Feb 10, 2022
@flack
Copy link
Contributor Author
flack commented Feb 10, 2022

well, it worked with Swiftmailer, so from the point of view of the user it's still a regression

@fabpot fabpot changed the base branch from 4.4 to 6.1 February 10, 2022 14:02
@fabpot
Copy link
Member
fabpot commented Feb 10, 2022

Thank you @flack.

@fabpot
Copy link
Member
fabpot commented Feb 10, 2022

We've been more and more strict about what we consider a bug. Stability is the most important thing for already released versions.

@flack
Copy link
Contributor Author
flack commented Feb 10, 2022

Yeah, makes sense I guess. Unfortunately, for me it means I have to continue using the abandoned Switfmailer package (with composer shouting at me every time I update something) until I can migrate to php 8+ and sf 6

@fabpot fabpot mentioned this pull request Apr 15, 2022
@veto221
Copy link
veto221 commented May 19, 2022

Hi.
Can I please for merge this for LTS version too?

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

Successfully merging this pull request may close these issues.

Mime: Email::embed doesn't work for background images
6 participants
0