James Cole
2024-03-16 06:25:56 +01:00
parent 7680c8733f
commit 060c9648f1
3 changed files with 186 additions and 178 deletions

View File

@@ -236,7 +236,8 @@ class AttachmentHelper implements AttachmentHelperInterface
$fileObject->rewind();
if (0 === $file->getSize()) {
throw new FireflyException('Cannot upload empty or non-existent file.');
$this->errors->add('attachments', trans('validation.file_zero_length'));
return null;
}
$content = (string)$fileObject->fread($file->getSize());

View File

@@ -312,6 +312,9 @@ class TagController extends Controller
if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));
}
if (count($this->attachmentsHelper->getErrors()->get('attachments')) > 0) {
$request->session()->flash('error', $this->attachmentsHelper->getErrors()->get('attachments'));
}
$redirect = redirect($this->getPreviousUrl('tags.create.url'));
if (1 === (int)$request->get('create_another')) {
session()->put('tags.create.fromStore', true);
@@ -347,6 +350,9 @@ class TagController extends Controller
if (count($this->attachmentsHelper->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachmentsHelper->getMessages()->get('attachments'));
}
if (count($this->attachmentsHelper->getErrors()->get('attachments')) > 0) {
$request->session()->flash('error', $this->attachmentsHelper->getErrors()->get('attachments'));
}
$redirect = redirect($this->getPreviousUrl('tags.edit.url'));
if (1 === (int)$request->get('return_to_edit')) {
session()->put('tags.edit.fromUpdate', true);