Skip to content

Commit a572a21

Browse files
authored
Merge pull request #654 from barbushin/585-Avoid-fetching-attachments-when-already-downloaded
#585: Avoid fetching attachments when they are already downloaded
2 parents 8a7de45 + d227aec commit a572a21

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/PhpImap/DataPartInfo.php

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public function fetch(): string
7979
if (0 === $this->part) {
8080
$this->data = Imap::body($this->mail->getImapStream(), $this->id, $this->options);
8181
} else {
82+
if (null !== $this->data) {
83+
return $this->data;
84+
}
8285
$this->data = Imap::fetchbody($this->mail->getImapStream(), $this->id, $this->part, $this->options);
8386
}
8487

0 commit comments

Comments
 (0)