Skip to content

Commit

Permalink
Only show size for regular files
Browse files Browse the repository at this point in the history
This avoids showing a meaningless '0 B' (or misleading arbitrary other
size) for folders.  Other special files also lack a meaningful size, so
don't show them either.

Symlinks are a bit of a tricky case here: we currently show the size
of the link (which is the length of the link target in bytes).  We could
show the size of the target, but this is a bit odd.  Let's show nothing.

Fixes #531
  • Loading branch information
allisonkarlitskaya authored and jelly committed Jun 7, 2024
1 parent 60265cd commit 78e8502
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/files-card-body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const Row = React.memo(function Item({ file, isSelected }) {
className="item-size"
dataLabel="size"
>
{cockpit.format_bytes(file.size)}
{file.type === 'reg' && cockpit.format_bytes(file.size)}
</Td>
<Td
className="item-date"
Expand Down

0 comments on commit 78e8502

Please sign in to comment.