Handling if data is empty in FileCard.

This commit is contained in:
Roland 2023-03-25 21:06:15 -06:00
parent f439e411b6
commit f3e2c0d7e8
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 6 additions and 3 deletions

View file

@ -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}) {
<CardContent {...s}>
<CardHeader>
<ExternalCardLink to={downloadUrl}>
{cardTitleWrapper(file.title || file.stem || file.primary_path)}
{cardTitleWrapper(file.title || file.name || file.primary_path)}
</ExternalCardLink>
</CardHeader>
{author && <b {...s}>{author}</b>}

View file

@ -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',