Skip to content

Fix: upload input v3 file size - #304

Open
santipalenque wants to merge 2 commits into
mainfrom
fix/upload-input-v3-file-size
Open

Fix: upload input v3 file size#304
santipalenque wants to merge 2 commits into
mainfrom
fix/upload-input-v3-file-size

Conversation

@santipalenque

@santipalenque santipalenque commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

https://app.clickup.com/t/9014802374/86bb61cdw

Summary by CodeRabbit

  • Bug Fixes

    • Improved uploaded-file status display when file size information is unavailable.
    • Completed files without a known size now show their completion status without displaying an incorrect 0 KB value.
  • Tests

    • Updated coverage to verify the corrected missing-size behavior.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The upload input now omits size text when a completed file has no size. The test verifies this behavior. The package version changes to 5.0.47-beta.0.

Changes

Upload status update

Layer / File(s) Summary
Handle missing upload sizes
src/components/inputs/upload-input-v3/index.js, src/components/inputs/upload-input-v3/__tests__/upload-input-v3.test.js
Completed files without a size show the Complete label without KB or MB text.
Update package version
package.json
The package version changes from 5.0.44 to 5.0.47-beta.0.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: smarcet, tomrndom

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the upload input v3 file-size fix, which matches the main code and test changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/upload-input-v3-file-size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/inputs/upload-input-v3/index.js`:
- Line 478: Update the file-size display in the upload completion rendering near
formatFileSize so zero-byte files retain and show “0 KB ·”. Replace the
truthiness check on file.size with a missing-metadata check that only omits the
size when file or its size is unavailable, and add a test covering a zero-byte
file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7869b93b-3624-4e49-a97e-cc57960ed706

📥 Commits

Reviewing files that changed from the base of the PR and between 43f0d8c and 59a9ef1.

📒 Files selected for processing (3)
  • package.json
  • src/components/inputs/upload-input-v3/__tests__/upload-input-v3.test.js
  • src/components/inputs/upload-input-v3/index.js

</Typography>
<Typography variant="caption" color="text.secondary">
{fileSize} · {T.translate("upload_input_v3.complete")}
{file?.size ? `${fileSize} ·` : ''} {T.translate("upload_input_v3.complete")}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve the size for zero-byte files.

formatFileSize returns 0 KB when file.size is 0, but this truthiness check hides it. A valid empty file will display only Complete. Check for missing metadata instead and add a zero-byte test.

Proposed fix
-                    {file?.size ? `${fileSize} ·` : ''} {T.translate("upload_input_v3.complete")}
+                    {file?.size != null ? `${fileSize} ·` : ''} {T.translate("upload_input_v3.complete")}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{file?.size ? `${fileSize} ·` : ''} {T.translate("upload_input_v3.complete")}
{file?.size != null ? `${fileSize} ·` : ''} {T.translate("upload_input_v3.complete")}
🧰 Tools
🪛 ast-grep (0.45.0)

[warning] 476-478: A list component should have a key to prevent re-rendering
Context:
{file?.size ? ${fileSize} · : ''} {T.translate("upload_input_v3.complete")}

Note: [CWE-710] Improper Adherence to Coding Standards. Security best practice.

(list-component-needs-key)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/inputs/upload-input-v3/index.js` at line 478, Update the
file-size display in the upload completion rendering near formatFileSize so
zero-byte files retain and show “0 KB ·”. Replace the truthiness check on
file.size with a missing-metadata check that only omits the size when file or
its size is unavailable, and add a test covering a zero-byte file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant