diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-07 23:04:08 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-07 23:04:08 +0200 |
commit | d15a4719d2bc58827d7cbe616ab25aaf376c8293 (patch) | |
tree | 6d1a52e8e4be5f2175711498495e5161f13e0ebd /apps/files | |
parent | 971a311feec6c4c2de905bdbbe71c2cf60296cb2 (diff) | |
download | nextcloud-server-d15a4719d2bc58827d7cbe616ab25aaf376c8293.tar.gz nextcloud-server-d15a4719d2bc58827d7cbe616ab25aaf376c8293.zip |
fix folder upload in js
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/js/filelist.js | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 69c97e8b32a..4a595083304 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1103,33 +1103,38 @@ $(document).ready(function() { size += parseInt(file.size); data.context.attr('data-size', size); data.context.find('td.filesize').text(humanFileSize(size)); - } - else { + } else { // only append new file if uploaded into the current folder - if (file.directory != '/' && file.directory !== FileList.getCurrentDirectory()) { + if (file.directory !== '/' && file.directory !== FileList.getCurrentDirectory()) { - file_directory = file.directory.replace('/','').replace(/\/$/, "").split('/'); + var fileDirectory = file.directory.replace('/','').replace(/\/$/, "").split('/'); - if (file_directory.length == 1) { - file_directory = file_directory[0]; + if (fileDirectory.length === 1) { + fileDirectory = fileDirectory[0]; // Get the directory - if ($('tr[data-file="'+file_directory+'"]').length == 0) - { - FileList.addDir(file_directory, 0, new Date(), false); + if ($('tr[data-file="'+fileDirectory+'"]').length === 0) { + var dir = { + name: fileDirectory, + type: 'dir', + mimetype: 'httpd/unix-directory', + permissions: file.permissions, + size: 0, + id: file.parentId + }; + FileList.add(dir, {insert: true}); } - } - else { - file_directory = file_directory[0]; + } else { + fileDirectory = fileDirectory[0]; } - file_directory = FileList.findFileEl(file_directory); + fileDirectory = FileList.findFileEl(fileDirectory); // update folder size - var size = parseInt(file_directory.attr('data-size')); + var size = parseInt(fileDirectory.attr('data-size')); size += parseInt(file.size); - file_directory.attr('data-size', size); - file_directory.find('td.filesize').text(humanFileSize(size)); + fileDirectory.attr('data-size', size); + fileDirectory.find('td.filesize').text(humanFileSize(size)); return; } |