Skip to content
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

Bugproof: cutted filename #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1055,4 +1055,19 @@ public function testGbkCharsetDecoding()

static::assertSame('Hi', \trim($message->getDecodedContent()));
}

public function testCuttedFilename()
{
$this->mailbox->addMessage($this->getFixture('cutted_filename'));

$message = $this->mailbox->getMessage(1);
$attachments = $message->getAttachments();

static::assertCount(1, $attachments);

/** @var Message\AttachmentInterface $attachment */
$attachment = \current($attachments);

static::assertSame('Zählerstanderfassung_2019___Test1.csv', $attachment->getFilename());
}
}
31 changes: 31 additions & 0 deletions tests/fixtures/cutted_filename.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Return-Path: <[email protected]>
Delivered-To: [email protected]
To: <[email protected]>
From: Nodus IT | Bastian Schur <[email protected]>
Subject: Test #1
Message-ID: <[email protected]>
Date: Thu, 14 Nov 2019 11:23:39 +0100
Content-Type: multipart/mixed;
boundary="------------A14EB21F2391734320F0CC3C"
Content-Language: en-US
MIME-Version: 1.0

--------------A14EB21F2391734320F0CC3C
Content-Type: text/plain; charset="utf-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi

--------------A14EB21F2391734320F0CC3C
Content-Type: text/csv; charset="UTF-8";
name="=?UTF-8?Q?Z=c3=a4hlerstanderfassung=5f2019=5f=5f=5fTest1=2ecsv?="
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename*0*="UTF-8''%5A%C3%A4%68%6C%65%72%73%74%61%6E%64%65%72%66%61%73%73";
filename*1*="%75%6E%67%5F%32%30%31%39%5F%5F%5F%54%65%73%74%31%2E%63%73%76"

Nummer,Standort,Hersteller,Ger=C3=A4t,Seriennummer,S/W,Farbe,Scans,Datum
5761,"Mustra=C3=9Fe 5, 12345 Musterhausen",Brother,ABC,123456789,20000,3000=
0,12345,10.11.19

--------------A14EB21F2391734320F0CC3C--