Skip to content

Commit

Permalink
Fix default toast message for failed uploads with HTTP/2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
danxuliu committed Jun 14, 2022
1 parent 7522779 commit e15b43d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ OC.Uploader.prototype = _.extend({
}
}
console.error(e, data, response)
OC.Notification.show(message || data.errorThrown, {type: 'error'});
OC.Notification.show(message || data.errorThrown || t('files', 'File could not be uploaded'), {type: 'error'});
}

if (upload) {
Expand Down

0 comments on commit e15b43d

Please sign in to comment.