fohrloop / dash-uploader

The alternative upload component for python Dash applications.
MIT License
144 stars 30 forks source link

Uploading multiple files shows wrong total file count in case of errors #73

Closed fohrloop closed 2 years ago

fohrloop commented 2 years ago

Affected version: f033683 (flow-dev branch)

Steps to reproduce

  1. Use max_file_size for du.Upload
  2. Upload multiple files (folder of files) where part of files (e.g. 2 files) are below max_file_size and part of files (e.g. 2 files) is above max_file_size
  3. The upload text total files will reflect the original amount of selected files, even though some of the files were dropped away because of max_file_size. (In the figure: Uploading (64.00 Mb, File 1/4) should be Uploading (64.00 Mb, File 1/2))

image

fohrloop commented 2 years ago

This was actually giving also wrong total number of files in the dash callbacks as the props was not updated properly:

[2022-02-24 21:18:15,658] DEBUG in httprequesthandler: File saved to: C:\tmp\Uploads\75406064-95a6-11ec-afad-2016b9d15494\testfile.csv
<UploadStatus: latest_file = C:\tmp\Uploads\75406064-95a6-11ec-afad-2016b9d15494\testfile.csv, uploaded_files = [C:\tmp\Uploads\75406064-95a6-11ec-afad-2016b9d15494\testfile.csv], is_completed = False, n_uploaded = 1, n_total = 4, uploaded_size_mb = 114.44169998168945, total_size_mb = 228.8833999633789, progress = 0.5, upload_id = 75406064-95a6-11ec-afad-2016b9d15494>
fohrloop commented 2 years ago

Fixed in https://github.com/np-8/dash-uploader/commit/3360dc91767eb2792d5b3a3fcc813169217e9052