Skip to content

Firefly III: a personal finances manager

Fix display bug for attachments

James Colee16975469305
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 3d299e4e0c..81e067afb6 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -104,7 +104,7 @@ class Attachment extends Model
*/
public function getDescriptionAttribute($value)
{
- if (is_null($value)) {
+ if (is_null($value) || strlen($value) === 0) {
return null;
}
@@ -118,7 +118,7 @@ class Attachment extends Model
*/
public function getFilenameAttribute($value)
{
- if (is_null($value)) {
+ if (is_null($value) || strlen($value) === 0) {
return null;
}
@@ -132,7 +132,7 @@ class Attachment extends Model
*/
public function getMimeAttribute($value)
{
- if (is_null($value)) {
+ if (is_null($value) || strlen($value) === 0) {
return null;
}
@@ -147,7 +147,7 @@ class Attachment extends Model
*/
public function getNotesAttribute($value)
{
- if (is_null($value)) {
+ if (is_null($value) || strlen($value) === 0) {
return null;
}
@@ -162,7 +162,7 @@ class Attachment extends Model
*/
public function getTitleAttribute($value)
{
- if (is_null($value)) {
+ if (is_null($value) || strlen($value) === 0) {
return null;
}
diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twig
index 13da803c5a..bd78503b9b 100644
--- a/resources/views/transactions/show.twig
+++ b/resources/views/transactions/show.twig
@@ -161,7 +161,7 @@
<td>
<i class="fa {{ att.mime|mimeIcon }}"></i>
<a href="{{ route('attachments.download', att.id) }}" title="{{ att.filename }}">
- {% if att.title|length > 0 %}
+ {% if att.title %}
{{ att.title }}
{% else %}
{{ att.filename }}