openedx / openedx/paragon

[bug] Inaccurate file size calculations in Dropzone

Open
#3,010 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
140
Forks
100
Avg merge
1h 3m
Merged PRs (30d)
30

Description

I encountered a bug when used maxSize prop on the Dropzone component. I passed 20 * 1024 * 1024 that equals to 20MB. When I uploaded a file of size 20.3MB the error state didn't occurred. I investigated deeper and found out that 20 * 1024 * 1024 = 20971520 that is bigger than 20312736 (the file size). image

In that time the component displays the error correctly when I pass a file of 80MB. It says that File must be less than 20MB..

As a work around I passed 20 * 1000 * 1000 and obtained the desired behavior of the error state but the alert displays inaccurate value of 19.07MB.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Dropzone component's maxSize handling and inspect how uploaded file sizes and the displayed limit are calculated. Verify the behavior with a 20MB limit and files around that boundary; done means the validation rejects files over the limit and the error message shows an accurate value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.