Skip to content

Commit 6901b26

Browse files
authored
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)
1 parent 16d75a7 commit 6901b26

File tree

1 file changed

+1
-1
lines changed
  • packages/ui/src/fields/Upload/RelationshipContent

1 file changed

+1
-1
lines changed

packages/ui/src/fields/Upload/RelationshipContent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function RelationshipContent(props: Props) {
6262

6363
function generateMetaText(mimeType: string, size: number): string {
6464
const sections: string[] = []
65-
if (mimeType?.includes('image')) {
65+
if (size) {
6666
sections.push(formatFilesize(size))
6767
}
6868

0 commit comments

Comments
 (0)