mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-20 15:06:19 -05:00
Handling if data is empty in FileCard.
This commit is contained in:
parent
f439e411b6
commit
f3e2c0d7e8
2 changed files with 6 additions and 3 deletions
|
|
@ -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>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue