Skip to content

Commit

Permalink
Merge pull request #188 from QualityUnit/patch-1
Browse files Browse the repository at this point in the history
Fix empty utf8 quoted not parsed correctly #160
  • Loading branch information
zbateson committed Feb 22, 2022
2 parents 038d504 + f2cc996 commit d42fe9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Header/Part/MimeLiteralPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function decodeMatchedEntity($matches)
*/
private function decodeSplitPart($entity)
{
if (preg_match('/^=\?([A-Za-z\-_0-9]+)\*?([A-Za-z\-_0-9]+)?\?([QBqb])\?([^\?]+)\?=$/', $entity, $matches)) {
if (preg_match('/^=\?([A-Za-z\-_0-9]+)\*?([A-Za-z\-_0-9]+)?\?([QBqb])\?([^\?]*)\?=$/', $entity, $matches)) {
return $this->decodeMatchedEntity($matches);
}
$decoded = $this->convertEncoding($entity);
Expand Down
7 changes: 7 additions & 0 deletions tests/MailMimeParser/Header/Part/MimeLiteralPartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function testMimeEncoding()
$this->assertDecoded('Kilgore Trout', '=?US-ASCII?Q?Kilgore_Trout?=');
}

public function testDecodeEmpty()
{
$this->assertDecoded('', '=?US-ASCII?Q??=');
$this->assertDecoded('', '=?utf-8?Q??=');
}


public function testMimeEncodingNullLanguage()
{
$part = $this->assertDecoded('Kilgore Trout', '=?US-ASCII?Q?Kilgore_Trout?=');
Expand Down

0 comments on commit d42fe9a

Please sign in to comment.