summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Neumann <info@individual-it.net>2017-04-27 10:55:41 +0545
committerArtur Neumann <info@individual-it.net>2017-04-27 14:16:36 +0545
commit79c760a10c0befd868f9e1d2cc2f540125495efa (patch)
tree43a7274285fac0d716ff06e4a6bc657142cdaee6
parent4dab01d9ed3da9427dd8ec29bfbe5b436617bd52 (diff)
downloadnextcloud-server-79c760a10c0befd868f9e1d2cc2f540125495efa.tar.gz
nextcloud-server-79c760a10c0befd868f9e1d2cc2f540125495efa.zip
use jqXHR.fail() to check for failures
Signed-off-by: Artur Neumann <info@individual-it.net>
-rw-r--r--apps/files_sharing/js/files_drop.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js
index ddfcfcd3d8b..30de278484c 100644
--- a/apps/files_sharing/js/files_drop.js
+++ b/apps/files_sharing/js/files_drop.js
@@ -90,16 +90,15 @@
},
done: function(e, data) {
// Created
- if (data.jqXHR.status === 201) {
- var mimeTypeUrl = OC.MimeType.getIconUrl(data.files[0].type);
- $('#public-upload ul li[data-name="' + escapeHTML(data.files[0].name) + '"]').html('<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + escapeHTML(data.files[0].name));
- $('[data-toggle="tooltip"]').tooltip();
- } else {
- var name = data.files[0].name;
- OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: name}));
- $('#public-upload ul li[data-name="' + escapeHTML(name) + '"]').html(output({isUploading: false, name: escapeHTML(name)}));
- $('[data-toggle="tooltip"]').tooltip();
- }
+ var mimeTypeUrl = OC.MimeType.getIconUrl(data.files[0].type);
+ $('#public-upload ul li[data-name="' + escapeHTML(data.files[0].name) + '"]').html('<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + escapeHTML(data.files[0].name));
+ $('[data-toggle="tooltip"]').tooltip();
+ },
+ fail: function(e, data, errorThrown) {
+ var name = data.files[0].name;
+ OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: name}));
+ $('#public-upload ul li[data-name="' + escapeHTML(name) + '"]').html(output({isUploading: false, name: escapeHTML(name)}));
+ $('[data-toggle="tooltip"]').tooltip();
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);