Skip to content

Symfony\Component\Mime\Part\DataPart return unexpected param name on disposition attachment #59268

@linhvtm97

Description

@linhvtm97

Symfony version(s) affected

6.2 or above

Description

I am using Laravel Mailable for sending email and faced with an issue on showing file name on email reader
The reason is DataPart is responding with unexpected param name on construction

https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Mime/Part/DataPart.php
Line 45

 if (null !== $filename) {
            $this->filename = $filename;
            $this->setName($filename);
        }

This made my email response turn into

Content-Disposition: attachment; name=test.csv; filename=test.csv
Following rule at https://httpwg.org/specs/rfc6266.html
Content-Disposition should include those information

Content-Disposition: attachment; filename="EURO rates";

Please correct it by delete this line of code $this->setName($filename);

How to reproduce

Use Mailable function of Laravel to send an email
On receiving email, click show original of email
View response email to verify

Possible Solution

Remove line 45 of code at https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Mime/Part/DataPart.php

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy