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

Fix default toast message for failed uploads with HTTP/2 #32878

Merged

Conversation

danxuliu
Copy link
Member

When an upload fails a toast is shown with either a specific message or just the textual part of the HTTP error code (which comes from the upload failure handler and set by jQuery.ajax()). However, if there is neither a message nor an error then the toast will show the default message from the Toastify-js library, which is an undescriptive "Hi there!".

When HTTP/2 is used Chromium does not provide the textual part of the HTTP error code, so when an upload fails the toast can receive an empty message and thus just show "Hi there!". Now an explicit message is provided as a fallback to prevent that.

How to reproduce

  • Setup HTTP/2 (you will need HTTPS too, as browsers seem to ignore HTTP/2 when using plain HTTP)
  • Open the files app
  • Share a folder with another user
  • Remove share permission for Allow editing
  • Log in as that user in Chromium (Firefox works as expected)
  • Open the shared folder
  • Upload a file
  • Upload the same file again
  • In the conflict dialog, keep the new file

Result with this pull request

An error toast is shown with the message File could not be uploaded

Result without this pull request

An error toast is shown with the message Hi there!

When an upload fails a toast is shown with either a specific message or
just the textual part of the HTTP error code (which comes from the
upload failure handler and set by "jQuery.ajax()". However, if there
is neither a message nor an error then the toast will show the default
message from the Toastify-js library, which is an undescriptive "Hi
there!".

When HTTP/2 is used Chromium does not provide the textual part of the
HTTP error code, so when an upload fails the toast can receive an empty
message and thus just show "Hi there!". Now an explicit message is
provided as a fallback to prevent that.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu added bug 3. to review Waiting for reviews labels Jun 14, 2022
@danxuliu danxuliu added this to the Nextcloud 25 milestone Jun 14, 2022
@danxuliu danxuliu requested a review from a team June 14, 2022 14:11
@danxuliu
Copy link
Member Author

/backport to stable24

@danxuliu
Copy link
Member Author

/backport to stable23

@come-nc come-nc requested review from a team, PVince81, ArtificialOwl and skjnldsv and removed request for a team June 14, 2022 15:40
@blizzz blizzz merged commit 3763024 into master Jun 15, 2022
@blizzz blizzz deleted the fix-default-toast-message-for-failed-uploads-with-http2 branch June 15, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants