jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.73k stars 4.97k forks source link

Large file size warning (for multichunk uploads) uses different multi-byte units than notebook list. #6088

Open ihleonard-c3 opened 3 years ago

ihleonard-c3 commented 3 years ago

Describe the bug The large file size warning (https://github.com/jupyter/notebook/blob/2cfff07a39fa486a3f05c26b400fa26e1802a053/notebook/static/tree/js/notebooklist.js#L308) uses the power of 2 scale to calculate the upload size, whereas the notebook list formatter uses power of 10 (https://github.com/jupyter/notebook/blob/2cfff07a39fa486a3f05c26b400fa26e1802a053/notebook/static/base/js/utils.js#L1066).

To Reproduce Steps to reproduce the behavior: Select a 73MB file for upload. The large file size warning will say "The file size is 70MB." After the file has been uploaded, it will show as 73 MB in the tree view.

Expected behavior These should be consistent, and probably both just use the more common power of 10.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): N/A

kevin-bates commented 3 years ago

Actually, if the units are going to be KB, MB, GB, etc., then the correct approach would be to use the power of 2 scale. Right now, the only correctly displayed sizes are those under 1 KB. All others are over-reported. image

-rw-r--r--   1 kbates  staff       3342 May 14  2019 python2.ipynb
-rw-r--r--   1 kbates  staff        826 Apr 10  2020 python3 with token.ipynb
-rw-r--r--   1 kbates  staff       4769 May 20 14:20 python3.ipynb
-rw-r--r--   1 kbates  staff       2190 Mar  9  2019 python_distributed.ipynb
-rw-r--r--   1 kbates  staff       1104 Feb 22  2019 r - spark local.ipynb

It looks like Lab chose not to display the file sizes (or I can't find a way to enable their display). As a result, I'm not sure how much effort should be put into this. If someone would like to take a crack at this, seems like some low-hanging fruit.