mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Log some errors for #960
This commit is contained in:
@@ -102,12 +102,17 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
public function saveAttachmentsForModel(Model $model, ?array $files): bool
|
public function saveAttachmentsForModel(Model $model, ?array $files): bool
|
||||||
{
|
{
|
||||||
if (is_array($files)) {
|
if (is_array($files)) {
|
||||||
|
/** @var UploadedFile $entry */
|
||||||
foreach ($files as $entry) {
|
foreach ($files as $entry) {
|
||||||
if (!is_null($entry)) {
|
if (!is_null($entry)) {
|
||||||
$this->processFile($entry, $model);
|
$this->processFile($entry, $model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Log::debug('Done processing uploads.');
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
Log::debug('Array of files is not an array. Probably nothing uploaded. Will not store attachments.');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -128,6 +133,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$msg = (string)trans('validation.file_already_attached', ['name' => $name]);
|
$msg = (string)trans('validation.file_already_attached', ['name' => $name]);
|
||||||
$this->errors->add('attachments', $msg);
|
$this->errors->add('attachments', $msg);
|
||||||
|
Log::error($msg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,6 +200,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
if (!in_array($mime, $this->allowedMimes)) {
|
if (!in_array($mime, $this->allowedMimes)) {
|
||||||
$msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
|
$msg = (string)trans('validation.file_invalid_mime', ['name' => $name, 'mime' => $mime]);
|
||||||
$this->errors->add('attachments', $msg);
|
$this->errors->add('attachments', $msg);
|
||||||
|
Log::error($msg);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -215,6 +222,7 @@ class AttachmentHelper implements AttachmentHelperInterface
|
|||||||
if ($size > $this->maxUploadSize) {
|
if ($size > $this->maxUploadSize) {
|
||||||
$msg = (string)trans('validation.file_too_large', ['name' => $name]);
|
$msg = (string)trans('validation.file_too_large', ['name' => $name]);
|
||||||
$this->errors->add('attachments', $msg);
|
$this->errors->add('attachments', $msg);
|
||||||
|
Log::error($msg);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -345,6 +345,7 @@ class SingleController extends Controller
|
|||||||
$this->attachments->saveAttachmentsForModel($journal, $files);
|
$this->attachments->saveAttachmentsForModel($journal, $files);
|
||||||
|
|
||||||
// store the journal only, flash the rest.
|
// store the journal only, flash the rest.
|
||||||
|
Log::debug(sprintf('Count of error messages is %d', $this->attachments->getErrors()->count()));
|
||||||
if (count($this->attachments->getErrors()->get('attachments')) > 0) {
|
if (count($this->attachments->getErrors()->get('attachments')) > 0) {
|
||||||
Session::flash('error', $this->attachments->getErrors()->get('attachments'));
|
Session::flash('error', $this->attachments->getErrors()->get('attachments'));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user