Skip to content

[TwigBridge] Allow attachment name to be set for inline images #60163

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
Apr 16, 2025

Conversation

aleho
Copy link
Contributor

@aleho aleho commented Apr 7, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
License MIT

Using a recommended setup attaching images from Twig would normally result in attachment names like @assets/img/file.png which might not be a good file name to expose to email clients. This allows the name to be specified, analogous to attach in the same wrapper.

@carsonbot carsonbot added this to the 7.3 milestone Apr 7, 2025
@carsonbot carsonbot changed the title [Twig Bridge][Mime] Allow attachment name to be set for inline images [Mime] [Twig Bridge] Allow attachment name to be set for inline images Apr 7, 2025
@OskarStark OskarStark changed the title [Mime] [Twig Bridge] Allow attachment name to be set for inline images [Mime][Twig Bridge] Allow attachment name to be set for inline images Apr 7, 2025
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

How can this be tested?

@aleho
Copy link
Contributor Author

aleho commented Apr 8, 2025

@nicolas-grekas I could write a test case for WrappedTemplatedEmail and trigger all the HTML handling like sending it. That would need a template and small image for tests. I'd only start if that's OK for you because I don't want to throw away that work.

@nicolas-grekas
Copy link
Member

The proposal looks good to me. I'd say it just misses some tests + a line in the CHANGELOG file of the bridge.

@aleho aleho changed the title [Mime][Twig Bridge] Allow attachment name to be set for inline images [Twig Bridge][Mime] Allow attachment name to be set for inline images Apr 11, 2025
@aleho aleho force-pushed the 7.3 branch 2 times, most recently from f7281a8 to eda234a Compare April 11, 2025 07:25
@aleho
Copy link
Contributor Author

aleho commented Apr 11, 2025

@nicolas-grekas I'm not too happy with hard-coding the strings to test like that because of how line breaks are handled, but I guess the intention is clear and they should be easy to maintain if something changes.

The Doctrine tests failing are hopefully not related to my changes?

@nicolas-grekas nicolas-grekas changed the title [Twig Bridge][Mime] Allow attachment name to be set for inline images [TwigBridge][Mime] Allow attachment name to be set for inline images Apr 16, 2025
@carsonbot carsonbot changed the title [TwigBridge][Mime] Allow attachment name to be set for inline images [TwigBridge] Allow attachment name to be set for inline images Apr 16, 2025
@nicolas-grekas
Copy link
Member

Thank you @aleho.

@nicolas-grekas nicolas-grekas merged commit 01c26aa into symfony:7.3 Apr 16, 2025
7 of 11 checks passed
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.

3 participants