Skip to content

Exception thrown if content-type has line breaks #569

Open
@skurrilewelt

Description

@skurrilewelt

I stumbled over emails with following headers:

more headers above
X-Mailer: xxx-xxxx-4.5.347
Content-Type: multipart/alternative; boundary=
        "=_7712c5e3690ec5b8367846b5=4dbc0b8a-a13f-5411-81ce-67cd64fd9617_="
Received-SPF: pass (1216.central...

When parsing this headers boundary is empty string and the message could not be loaded, furthermore an error will be thrown.

A possible fix can be in Header.php:

public function find($pattern): mixed {
    if (preg_match_all($pattern, str_replace("\r\n", " ", $this->raw), $matches)) {
        if (isset($matches[1])) {
            if (count($matches[1]) > 0) {
                return $matches[1][0];
            }
        }
    }
    return null;
}

Now boundary has the expected content. I can't see any usages of this method except in Header::getBoundary().

Im using the newest 5.x version.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions