mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Fix for #1737
This commit is contained in:
@@ -342,6 +342,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
* @param UploadedFile $file
|
||||
*
|
||||
* @return MessageBag
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function storeFileUpload(ImportJob $job, string $name, UploadedFile $file): MessageBag
|
||||
{
|
||||
@@ -374,6 +375,12 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
$attachment->save();
|
||||
$fileObject = $file->openFile('r');
|
||||
$fileObject->rewind();
|
||||
|
||||
|
||||
if(0 === $file->getSize()) {
|
||||
throw new FireflyException('Cannot upload empty or non-existent file.');
|
||||
}
|
||||
|
||||
$content = $fileObject->fread($file->getSize());
|
||||
$encrypted = Crypt::encrypt($content);
|
||||
$this->uploadDisk->put($attachment->fileName(), $encrypted);
|
||||
|
Reference in New Issue
Block a user