aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
authorPellaeon Lin <nfsmwlin@gmail.com>2014-01-30 22:50:20 +0800
committerPellaeon Lin <nfsmwlin@gmail.com>2014-01-30 22:50:20 +0800
commit099b71c712c38de7dac7e386252da02bb0cadf12 (patch)
tree84bcf83efdc4cc759a5ff184fa5148195abaab51 /apps/files/js/file-upload.js
parent929c930b0afd682bb98eb389d7ebad91bb34d643 (diff)
parent299a8285bd2601ccbac988b2e3e9b067d47921a2 (diff)
downloadnextcloud-server-099b71c712c38de7dac7e386252da02bb0cadf12.tar.gz
nextcloud-server-099b71c712c38de7dac7e386252da02bb0cadf12.zip
Merge branch 'master' into pr-exceed_upload_limit_msg
Conflicts: apps/files/templates/index.php apps/files_sharing/templates/public.php
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 0d7df31f355..149e4a9666b 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -222,6 +222,14 @@ $(document).ready(function() {
//examine file
var file = data.files[0];
+ try {
+ // FIXME: not so elegant... need to refactor that method to return a value
+ Files.isFileNameValid(file.name);
+ }
+ catch (errorMessage) {
+ data.textStatus = 'invalidcharacters';
+ data.errorThrown = errorMessage;
+ }
if (file.type === '' && file.size === 4096) {
data.textStatus = 'dirorzero';
@@ -319,6 +327,13 @@ $(document).ready(function() {
} else {
// HTTP connection problem
OC.Notification.show(data.errorThrown);
+ if (data.result) {
+ var result = JSON.parse(data.result);
+ if (result && result[0] && result[0].data && result[0].data.code === 'targetnotfound') {
+ // abort upload of next files if any
+ OC.Upload.cancelUploads();
+ }
+ }
}
//hide notification after 10 sec
setTimeout(function() {
@@ -617,7 +632,7 @@ $(document).ready(function() {
if (result.status === 'success') {
var date=new Date();
FileList.addDir(name, 0, date, hidden);
- var tr=$('tr[data-file="'+name+'"]');
+ var tr = FileList.findFileEl(name);
tr.attr('data-id', result.data.id);
} else {
OC.dialogs.alert(result.data.message, t('core', 'Could not create folder'));
@@ -659,7 +674,7 @@ $(document).ready(function() {
$('#uploadprogressbar').fadeOut();
var date = new Date();
FileList.addFile(localName, size, date, false, hidden);
- var tr = $('tr[data-file="'+localName+'"]');
+ var tr = FileList.findFileEl(localName);
tr.data('mime', mime).data('id', id);
tr.attr('data-id', id);
var path = $('#dir').val()+'/'+localName;
@@ -670,7 +685,12 @@ $(document).ready(function() {
});
eventSource.listen('error',function(error) {
$('#uploadprogressbar').fadeOut();
- alert(error);
+ var message = (error && error.message) || t('core', 'Error fetching URL');
+ OC.Notification.show(message);
+ //hide notification after 10 sec
+ setTimeout(function() {
+ OC.Notification.hide();
+ }, 10000);
});
break;
}