Fix error when un-decryptable files would break the export.

This commit is contained in:
James Cole 2018-04-29 07:42:17 +02:00
parent 9cbbd581ee
commit 8acb9f4056
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -94,7 +94,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
private function exportAttachment(Attachment $attachment): bool
{
$file = $attachment->fileName();
$file = $attachment->fileName();
$decrypted = false;
if ($this->uploadDisk->exists($file)) {
try {
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
@ -104,6 +105,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
return false;
}
}
if ($decrypted === false) {
return false;
}
$exportFile = $this->exportFileName($attachment);
$this->exportDisk->put($exportFile, $decrypted);
$this->getEntries()->push($exportFile);