-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attachment handling fixed (Plain text files are no longer ignored)
- Loading branch information
Showing
3 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,7 +306,7 @@ private function parseBody() { | |
* @param mixed $partNumber | ||
*/ | ||
private function fetchStructure($structure, $partNumber = null) { | ||
if ($structure->type == self::TYPE_TEXT) { | ||
if ($structure->type == self::TYPE_TEXT && $partNumber == null) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Webklex
Author
Owner
|
||
if ($structure->subtype == "PLAIN") { | ||
if (!$partNumber) { | ||
$partNumber = 1; | ||
|
@@ -347,7 +347,7 @@ private function fetchStructure($structure, $partNumber = null) { | |
if ($partNumber) { | ||
$prefix = $partNumber . "."; | ||
} | ||
|
||
var_dump($structure); | ||
$this->fetchStructure($subStruct, $prefix . ($index + 1)); | ||
} | ||
} else { | ||
|
@@ -410,10 +410,14 @@ private function fetchStructure($structure, $partNumber = null) { | |
$attachment->img_src = 'data:'.$attachment->content_type.';base64,'.base64_encode($attachment->content); | ||
} | ||
|
||
if ($attachment->id) { | ||
$this->attachments[$attachment->id] = $attachment; | ||
} else { | ||
$this->attachments[] = $attachment; | ||
if(property_exists($attachment, 'name')){ | ||
if($attachment->name != false){ | ||
if ($attachment->id) { | ||
$this->attachments[$attachment->id] = $attachment; | ||
} else { | ||
$this->attachments[] = $attachment; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -515,4 +519,13 @@ public function delete(){ | |
public function restore(){ | ||
return imap_undelete($this->client->connection, $this->message_no); | ||
} | ||
|
||
/** | ||
* Get all message attachments. | ||
* | ||
* @return \Illuminate\Support\Collection | ||
*/ | ||
public function getAttachments(){ | ||
return collect($this->attachments); | ||
} | ||
} |
Hello,
Why did you add the
$partNumber
validation?