From 8acb9f405650a23cd0c0a1c919943f816cbfaf8d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Apr 2018 07:42:17 +0200 Subject: [PATCH] Fix error when un-decryptable files would break the export. --- app/Export/Collector/AttachmentCollector.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.php index 5405855e3b..244cc919ed 100644 --- a/app/Export/Collector/AttachmentCollector.php +++ b/app/Export/Collector/AttachmentCollector.php @@ -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);