diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-01-10 15:02:26 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-01-10 15:02:26 +0100 |
commit | 1042733634622b234beb52e24505d56a9883b4eb (patch) | |
tree | 4300040f44d951823645d35d98e1b263de49fd07 /apps/files/js/files.js | |
parent | b24c21b00f0116e8749f37646cc25f798992bf05 (diff) | |
download | nextcloud-server-1042733634622b234beb52e24505d56a9883b4eb.tar.gz nextcloud-server-1042733634622b234beb52e24505d56a9883b4eb.zip |
Fixed various file name escaping issues in core apps
- Refactored file tr lookup into FileList.findFileEl that uses
filterAttr to avoid escaping issues in jQuery selectors
- Fixed versions and sharing app to properly escape file names in
attributes
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index fdaa3aa3342..1f12ade8d79 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -282,7 +282,7 @@ $(document).ready(function() { procesSelection(); } else { var filename=$(this).parent().parent().attr('data-file'); - var tr=$('tr[data-file="'+filename+'"]'); + var tr = FileList.findFileEl(filename); var renaming=tr.data('renaming'); if (!renaming && !FileList.isLoading(filename)) { FileActions.currentFile = $(this).parent(); @@ -541,10 +541,12 @@ var folderDropOptions={ if (result) { if (result.status === 'success') { //recalculate folder size - var oldSize = $('#fileList tr[data-file="'+target+'"]').data('size'); - var newSize = oldSize + $('#fileList tr[data-file="'+file+'"]').data('size'); - $('#fileList tr[data-file="'+target+'"]').data('size', newSize); - $('#fileList tr[data-file="'+target+'"]').find('td.filesize').text(humanFileSize(newSize)); + var oldFile = FileList.findFileEl(target); + var newFile = FileList.findFileEl(file); + var oldSize = oldFile.data('size'); + var newSize = oldSize + newFile.data('size'); + oldFile.data('size', newSize); + oldFile.find('td.filesize').text(humanFileSize(newSize)); FileList.remove(file); procesSelection(); @@ -738,7 +740,7 @@ Files.lazyLoadPreview = function(path, mime, ready, width, height, etag) { } function getUniqueName(name) { - if ($('tr[data-file="'+name+'"]').exists()) { + if (FileList.findFileEl(name).exists()) { var parts=name.split('.'); var extension = ""; if (parts.length > 1) { |