Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect file loaded reporting #1007

Merged

Conversation

mkszepp
Copy link
Contributor

@mkszepp mkszepp commented Oct 23, 2023

When the upload is completed, request.onprogress will be fired at the same time like request.onloadend.
As the upload is completed with request.onprogress the server returns the Content-Length and the browser takes this size... In my case the returned Content-Length is lower, because i don't return the image and so the progress bar is going back.

My debug console.logs:
grafik

To fix this behavier we should replace the file.loaded set in request.onprogress to:
file.loaded = Math.max(evt.loaded, file.loaded); instead of file.loaded = evt.loaded;

Comment copied from: #1002 (comment)

@mkszepp
Copy link
Contributor Author

mkszepp commented Oct 23, 2023

@gilest one think, that we should discuss.. should we check in the "onprogress" if file.loaded is not > than file.size, otherwise it can occures that a file has more than 100%

@mkszepp
Copy link
Contributor Author

mkszepp commented Oct 30, 2023

@gilest friendly ping

@gilest gilest added the bug label Nov 2, 2023
@gilest gilest changed the title Use Math.max for loaded value Incorrect file loaded reporting Nov 2, 2023
@gilest
Copy link
Collaborator

gilest commented Nov 2, 2023

Hey @mkszepp thanks for this! As before I think this looks more correct than the previous implementation.

It would be cool to take your collected logs and use them to build a regression test but I don't think that should block this being released.

@gilest gilest merged commit 7fa498c into adopted-ember-addons:master Nov 2, 2023
14 checks passed
@gilest
Copy link
Collaborator

gilest commented Nov 2, 2023

Released in 8.3.0

@mkszepp mkszepp deleted the fix-progress-loaded-value branch November 6, 2023 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants