bug #64047 [Mime] Preserve inline part filename instead of overwriting it with the Content-ID (ousamabenyounes)
This PR was merged into the 6.4 branch. Discussion ---------- [Mime] Preserve inline part filename instead of overwriting it with the Content-ID | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #62423 | License | MIT When an inline `DataPart` is matched against a `cid:` reference in an HTML body, `Email::prepareParts()` overwrites the part's name with the auto-generated `Content-ID` (e.g. `abcd...`@symfony``). That value then ends up as the `name=` parameter on both `Content-Type` and `Content-Disposition`, where it looks like a filename with an unsupported extension. Some mail providers reject the message with `5.7.1 Forbidden attachment type` (reproduced and acknowledged in #62423). Before: ``` Content-ID: <divider-500x2@example.com> Content-Type: image/jpeg; name="divider-500x2@example.com" Content-Transfer-Encoding: base64 Content-Disposition: inline; name="divider-500x2@example.com"; filename=divider-500x2.jpg ``` After: ``` Content-ID: <divider-500x2@example.com> Content-Type: image/jpeg; name=divider-500x2.jpg Content-Transfer-Encoding: base64 Content-Disposition: inline; name=divider-500x2.jpg; filename=divider-500x2.jpg ``` Only fall back to the `Content-ID` when the part has no name (preserves the previous behavior for inline parts created without a filename, e.g. raw `Email::embed()` callers that don't pass a name). Commits ------- 97e613e9d69 [Mime] Preserve inline part filename instead of overwriting it with the Content-ID
N
Nicolas Grekas committed
330077bc7fbe314758aff62834b758d06ac6d260