From f3e2c0d7e8801737dfd22adbb801152b94164567 Mon Sep 17 00:00:00 2001 From: Roland Date: Sat, 25 Mar 2023 21:06:15 -0600 Subject: [PATCH] Handling if data is empty in FileCard. --- app/src/components/Files.js | 7 +++++-- modules/videos/video/lib.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/components/Files.js b/app/src/components/Files.js index e71a051d..4e0cf8e0 100644 --- a/app/src/components/Files.js +++ b/app/src/components/Files.js @@ -139,7 +139,10 @@ function FileCard({file}) { } const {data} = file; - const {author} = data; + let author; + if (data) { + author = data['author']; + } const downloadUrl = `/download/${encodeURIComponent(file.primary_path)}`; const color = mimetypeColor(file.mimetype); const size = file.size !== null && file.size !== undefined ? humanFileSize(file.size) : null; @@ -153,7 +156,7 @@ function FileCard({file}) { - {cardTitleWrapper(file.title || file.stem || file.primary_path)} + {cardTitleWrapper(file.title || file.name || file.primary_path)} {author && {author}} diff --git a/modules/videos/video/lib.py b/modules/videos/video/lib.py index 268cd9a0..85bc6a22 100644 --- a/modules/videos/video/lib.py +++ b/modules/videos/video/lib.py @@ -39,7 +39,7 @@ def get_video_for_app(video_id: int) -> Tuple[dict, Optional[dict], Optional[dic VIDEO_ORDERS = { 'upload_date': 'v.upload_date ASC, LOWER(fg.primary_path) ASC', - '-upload_date': 'v.upload_date DESC NULLS LAST, LOWER(fg.primary_path) DESC', + '-upload_date': 'v.upload_date DESC NULLS LAST, LOWER(fg.primary_path) ASC', 'rank': '2 DESC, LOWER(fg.primary_path) DESC', '-rank': '2 ASC, LOWER(fg.primary_path) ASC', 'id': 'fg.id ASC',