fix(ui): prevent omitting fileSize from non-images (#11146)

### What?
This PR displays file size in upload cards for all upload mimetypes. The
current behavior hides this metric from the user if the file mimetype
does not start with `image`.

### Why?
Showing end-users and editors a file size is universally useful - not
only for images, but for all types of files that can be uploaded via the
upload field.

### How?
By making the predicate that adds this metric less restrictive. Instead
of checking if the mimetype is image-like, it checks if the file size is
truthy.

Before:

![image](https://github.com/user-attachments/assets/949e3be9-6dca-43c3-b2f8-a7e91307e48e)

After:

![image](https://github.com/user-attachments/assets/cb500390-dc64-48e3-a87c-e4ec4d19d019)
This commit is contained in:
Said Akhrarov
2025-02-13 16:05:12 -05:00
committed by GitHub
parent 16d75a7c7b
commit 6901b2639d

View File

@@ -62,7 +62,7 @@ export function RelationshipContent(props: Props) {
function generateMetaText(mimeType: string, size: number): string {
const sections: string[] = []
if (mimeType?.includes('image')) {
if (size) {
sections.push(formatFilesize(size))
}