From 69f2bde324cd491937a90948a23b06a06c2f2400 Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Sun, 8 Dec 2013 15:41:20 +0800 Subject: Change misleading message when file size exceeds upload limit --- apps/files/js/file-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index e9663353f74..979bb74b13f 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -235,8 +235,8 @@ $(document).ready(function() { //check max upload size if (selection.totalBytes > $('#max_upload').val()) { - data.textStatus = 'notenoughspace'; - data.errorThrown = t('files', 'Not enough space available'); + data.textStatus = 'sizeexceedlimit'; + data.errorThrown = t('files', 'File size exceeds upload limit'); } // end upload for whole selection on error -- cgit v1.2.3 From 64bf0fa47fe4c623672cf86e831f66974e7f650c Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Sun, 8 Dec 2013 23:17:35 +0800 Subject: Display different messages for uploadLimit and freeSpace --- apps/files/index.php | 4 ++++ apps/files/js/file-upload.js | 10 ++++++++-- apps/files/templates/index.php | 5 +++-- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/index.php b/apps/files/index.php index 8f6838aa0d9..4ea0f9f2496 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -103,6 +103,8 @@ if ($needUpgrade) { } else { // information about storage capacities $storageInfo=OC_Helper::getStorageInfo($dir); + $freeSpace=OCP\Util::freeSpace($dir); + $uploadLimit=OCP\Util::uploadLimit(); $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'); // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) @@ -136,6 +138,8 @@ if ($needUpgrade) { $tmpl->assign('trashEmpty', $trashEmpty); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); + $tmpl->assign('freeSpace', $freeSpace); + $tmpl->assign('uploadLimit', $uploadLimit); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); $tmpl->assign('isPublic', false); diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 979bb74b13f..7bd0eb81f57 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -233,11 +233,17 @@ $(document).ready(function() { // add size selection.totalBytes += file.size; - //check max upload size - if (selection.totalBytes > $('#max_upload').val()) { + // check PHP upload limit + if (selection.totalBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; data.errorThrown = t('files', 'File size exceeds upload limit'); } + + // check free space + if (selection.totalBytes > $('#free_space').val()) { + data.textStatus = 'notenoughspace'; + data.errorThrown = t('files', 'Not enough free space'); + } // end upload for whole selection on error if (data.errorThrown) { diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 00ec109621f..3d8a7f78e41 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -15,9 +15,10 @@
= 0):?> - + + + -- cgit v1.2.3 From 5ddd85ff9cb64c10974804e810f8f68f275114a3 Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Wed, 11 Dec 2013 15:40:58 +0800 Subject: Contextual upload error message --- apps/files/js/file-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 7bd0eb81f57..1a36a580532 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -236,13 +236,13 @@ $(document).ready(function() { // check PHP upload limit if (selection.totalBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; - data.errorThrown = t('files', 'File size exceeds upload limit'); + data.errorThrown = t('files', 'Total file size {size1} exceeds upload limit {size2}').replace('{size1}', humanFileSize(selection.totalBytes)).replace('{size2}', humanFileSize($('#upload_limit').val())); } // check free space if (selection.totalBytes > $('#free_space').val()) { data.textStatus = 'notenoughspace'; - data.errorThrown = t('files', 'Not enough free space'); + data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left').replace('{size1}', humanFileSize(selection.totalBytes)).replace('{size2}', humanFileSize($('#free_space').val())); } // end upload for whole selection on error -- cgit v1.2.3 From cd6ab2931325323cb59961c4327a18d934ecc72a Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Thu, 16 Jan 2014 17:51:00 +0800 Subject: Use t() 's native method --- apps/files/js/file-upload.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 1a36a580532..a003e5eec86 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -236,13 +236,19 @@ $(document).ready(function() { // check PHP upload limit if (selection.totalBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; - data.errorThrown = t('files', 'Total file size {size1} exceeds upload limit {size2}').replace('{size1}', humanFileSize(selection.totalBytes)).replace('{size2}', humanFileSize($('#upload_limit').val())); + data.errorThrown = t('files', 'Total file size {size1} exceeds upload limit {size2}', { + 'size1': humanFileSize(selection.totalBytes), + 'size2': humanFileSize($('#upload_limit').val()) + }); } // check free space if (selection.totalBytes > $('#free_space').val()) { data.textStatus = 'notenoughspace'; - data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left').replace('{size1}', humanFileSize(selection.totalBytes)).replace('{size2}', humanFileSize($('#free_space').val())); + data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left', { + '{size1}': humanFileSize(selection.totalBytes), + '{size2}': humanFileSize($('#free_space').val()) + }); } // end upload for whole selection on error -- cgit v1.2.3 From 19675c2c9de3580c32ee24b22b8ded11dc110b1c Mon Sep 17 00:00:00 2001 From: Pellaeon Lin Date: Fri, 24 Jan 2014 22:54:16 +0800 Subject: Fix variable name --- apps/files/js/file-upload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index a003e5eec86..0d7df31f355 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -246,8 +246,8 @@ $(document).ready(function() { if (selection.totalBytes > $('#free_space').val()) { data.textStatus = 'notenoughspace'; data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left', { - '{size1}': humanFileSize(selection.totalBytes), - '{size2}': humanFileSize($('#free_space').val()) + 'size1': humanFileSize(selection.totalBytes), + 'size2': humanFileSize($('#free_space').val()) }); } -- cgit v1.2.3 From 58c7042e708172b8e2fe252fc53abe87bcf8c1f1 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 22 Jan 2014 17:17:58 +0100 Subject: Added error message for when target folder was removed Whent trying to upload/rename/create files in a folder that was removed or rename, the correct error message is now shown. In the case of upload of multiple files, the upload is cancelled. This situation can happen if the target folder was renamed or removed from another browser window or client. --- apps/files/ajax/newfile.php | 9 ++++++++ apps/files/ajax/newfolder.php | 9 ++++++++ apps/files/ajax/upload.php | 6 +++-- apps/files/js/file-upload.js | 7 ++++++ apps/files/lib/app.php | 7 ++++++ apps/files/tests/ajax_rename.php | 49 ++++++++++++++++++++++++++++++++++++++-- 6 files changed, 83 insertions(+), 4 deletions(-) (limited to 'apps/files/js/file-upload.js') diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index ec5b716fb2a..1853098c507 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -64,6 +64,15 @@ if(strpos($filename, '/') !== false) { exit(); } +if (!\OC\Files\Filesystem::file_exists($dir . '/')) { + $result['data'] = array('message' => (string)$l10n->t( + 'The target folder has been moved or deleted.'), + 'code' => 'targetnotfound' + ); + OCP\JSON::error($result); + exit(); +} + //TODO why is stripslashes used on foldername in newfolder.php but not here? $target = $dir.'/'.$filename; diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php index 2cbc8cfeba5..4cfcae3090d 100644 --- a/apps/files/ajax/newfolder.php +++ b/apps/files/ajax/newfolder.php @@ -29,6 +29,15 @@ if(strpos($foldername, '/') !== false) { exit(); } +if (!\OC\Files\Filesystem::file_exists($dir . '/')) { + $result['data'] = array('message' => (string)$l10n->t( + 'The target folder has been moved or deleted.'), + 'code' => 'targetnotfound' + ); + OCP\JSON::error($result); + exit(); +} + //TODO why is stripslashes used on foldername here but not in newfile.php? $target = $dir . '/' . stripslashes($foldername); diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index bdaf6a77d14..8f6c42d6620 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -8,6 +8,7 @@ OCP\JSON::setContentTypeHeader('text/plain'); // If no token is sent along, rely on login only $allowedPermissions = OCP\PERMISSION_ALL; +$errorCode = null; $l = OC_L10N::get('files'); if (empty($_POST['dirToken'])) { @@ -125,7 +126,8 @@ if (strpos($dir, '..') === false) { $meta = \OC\Files\Filesystem::getFileInfo($target); if ($meta === false) { - $error = $l->t('Upload failed. Could not get file info.'); + $error = $l->t('The target folder has been moved or deleted.'); + $errorCode = 'targetnotfound'; } else { $result[] = array('status' => 'success', 'mime' => $meta['mimetype'], @@ -177,5 +179,5 @@ if ($error === false) { OCP\JSON::encodedPrint($result); exit(); } else { - OCP\JSON::error(array(array('data' => array_merge(array('message' => $error), $storageStats)))); + OCP\JSON::error(array(array('data' => array_merge(array('message' => $error, 'code' => $errorCode), $storageStats)))); } diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 225c3319107..486273a910c 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -315,6 +315,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() { diff --git a/apps/files/lib/app.php b/apps/files/lib/app.php index 1ac266073db..fea88faa92a 100644 --- a/apps/files/lib/app.php +++ b/apps/files/lib/app.php @@ -59,6 +59,13 @@ class App { $result['data'] = array( 'message' => $this->l10n->t("Invalid folder name. Usage of 'Shared' is reserved.") ); + // rename to non-existing folder is denied + } else if (!$this->view->file_exists($dir)) { + $result['data'] = array('message' => (string)$this->l10n->t( + 'The target folder has been moved or deleted.', + array($dir)), + 'code' => 'targetnotfound' + ); // rename to existing file is denied } else if ($this->view->file_exists($dir . '/' . $newname)) { diff --git a/apps/files/tests/ajax_rename.php b/apps/files/tests/ajax_rename.php index 350ff5d3687..a1a5c8983ba 100644 --- a/apps/files/tests/ajax_rename.php +++ b/apps/files/tests/ajax_rename.php @@ -38,7 +38,7 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $l10nMock->expects($this->any()) ->method('t') ->will($this->returnArgument(0)); - $viewMock = $this->getMock('\OC\Files\View', array('rename', 'normalizePath', 'getFileInfo'), array(), '', false); + $viewMock = $this->getMock('\OC\Files\View', array('rename', 'normalizePath', 'getFileInfo', 'file_exists'), array(), '', false); $viewMock->expects($this->any()) ->method('normalizePath') ->will($this->returnArgument(0)); @@ -63,6 +63,11 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $oldname = 'Shared'; $newname = 'new_name'; + $this->viewMock->expects($this->at(0)) + ->method('file_exists') + ->with('/') + ->will($this->returnValue(true)); + $result = $this->files->rename($dir, $oldname, $newname); $expected = array( 'success' => false, @@ -80,6 +85,11 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $oldname = 'Shared'; $newname = 'new_name'; + $this->viewMock->expects($this->at(0)) + ->method('file_exists') + ->with('/test') + ->will($this->returnValue(true)); + $this->viewMock->expects($this->any()) ->method('getFileInfo') ->will($this->returnValue(array( @@ -129,6 +139,11 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $oldname = 'oldname'; $newname = 'newname'; + $this->viewMock->expects($this->at(0)) + ->method('file_exists') + ->with('/') + ->will($this->returnValue(true)); + $this->viewMock->expects($this->any()) ->method('getFileInfo') ->will($this->returnValue(array( @@ -141,7 +156,6 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { 'name' => 'new_name', ))); - $result = $this->files->rename($dir, $oldname, $newname); $this->assertTrue($result['success']); @@ -154,4 +168,35 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase { $this->assertEquals(\OC_Helper::mimetypeIcon('dir'), $result['data']['icon']); $this->assertFalse($result['data']['isPreviewAvailable']); } + + /** + * Test rename inside a folder that doesn't exist any more + */ + function testRenameInNonExistingFolder() { + $dir = '/unexist'; + $oldname = 'oldname'; + $newname = 'newname'; + + $this->viewMock->expects($this->at(0)) + ->method('file_exists') + ->with('/unexist') + ->will($this->returnValue(false)); + + $this->viewMock->expects($this->any()) + ->method('getFileInfo') + ->will($this->returnValue(array( + 'fileid' => 123, + 'type' => 'dir', + 'mimetype' => 'httpd/unix-directory', + 'size' => 18, + 'etag' => 'abcdef', + 'directory' => '/unexist', + 'name' => 'new_name', + ))); + + $result = $this->files->rename($dir, $oldname, $newname); + + $this->assertFalse($result['success']); + $this->assertEquals('targetnotfound', $result['data']['code']); + } } -- cgit v1.2.3 From d36a2ff9eeedc9ebb2ebbba5d55cc255281e9929 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 30 Jan 2014 10:41:04 +0100 Subject: Added .jshintrc - Also fixes a few JSHint warnings in files app - Added "global" comment on top of files app to suppress warning and also inform devs about what globals are use --- .jshintrc | 28 ++++++++++++++++++++++++++++ apps/files/js/admin.js | 12 +++++++++++- apps/files/js/file-upload.js | 12 ++++++++++++ apps/files/js/fileactions.js | 25 ++++++++++++++++++++----- apps/files/js/filelist.js | 17 +++++++++++++++-- apps/files/js/files.js | 23 ++++++++++++++++++----- apps/files/js/upgrade.js | 11 +++++++++++ apps/files/js/upload.js | 11 +++++++++++ apps/files/tests/js/fileactionsSpec.js | 3 +++ apps/files/tests/js/filelistSpec.js | 2 ++ apps/files/tests/js/filesSpec.js | 7 +++++-- 11 files changed, 136 insertions(+), 15 deletions(-) create mode 100644 .jshintrc (limited to 'apps/files/js/file-upload.js') diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 00000000000..f40dd22b5fd --- /dev/null +++ b/.jshintrc @@ -0,0 +1,28 @@ +{ + "camelCase": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "nonbsp": true, + "undef": true, + "unused": true, + "trailing": true, + "maxparams": 5, + "curly": true, + "jquery": true, + "maxlen": 80, + "indent": 4, + "browser": true, + "globals": { + "console": true, + "it": true, + "itx": true, + "expect": true, + "describe": true, + "beforeEach": true, + "afterEach": true, + "sinon": true, + "fakeServer": true + } +} diff --git a/apps/files/js/admin.js b/apps/files/js/admin.js index bfa96670635..f735079fcbe 100644 --- a/apps/files/js/admin.js +++ b/apps/files/js/admin.js @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + function switchPublicFolder() { var publicEnable = $('#publicEnable').is(':checked'); @@ -10,7 +20,7 @@ function switchPublicFolder() $(document).ready(function(){ switchPublicFolder(); // Execute the function after loading DOM tree $('#publicEnable').click(function(){ - switchPublicFolder(); // To get rid of onClick() + switchPublicFolder(); // To get rid of onClick() }); $('#allowZipDownload').bind('change', function() { diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 486273a910c..c4f6329d739 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + /** * The file upload code uses several hooks to interact with blueimps jQuery file upload library: * 1. the core upload handling hooks are added when initializing the plugin, @@ -8,6 +18,8 @@ * - TODO music upload button */ +/* global OC, t, n */ + /** * Function that will allow us to know if Ajax uploads are supported * @link https://github.com/New-Bamboo/example-ajax-upload/blob/master/public/index.html diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index d0ef2491bdf..ecd0484b0fe 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -1,3 +1,15 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC, FileList */ +/* global trashBinApp */ var FileActions = { actions: {}, defaults: {}, @@ -45,8 +57,9 @@ var FileActions = { return filteredActions; }, getDefault: function (mime, type, permissions) { + var mimePart; if (mime) { - var mimePart = mime.substr(0, mime.indexOf('/')); + mimePart = mime.substr(0, mime.indexOf('/')); } var name = false; if (mime && FileActions.defaults[mime]) { @@ -130,13 +143,14 @@ var FileActions = { parent.parent().children().last().find('.action.delete').remove(); if (actions['Delete']) { var img = FileActions.icons['Delete']; + var html; if (img.call) { img = img(file); } if (typeof trashBinApp !== 'undefined' && trashBinApp) { - var html = ''; + html = ''; } else { - var html = ''; + html = ''; } var element = $(html); element.data('action', actions['Delete']); @@ -163,10 +177,11 @@ var FileActions = { }; $(document).ready(function () { + var downloadScope; if ($('#allowZipDownload').val() == 1) { - var downloadScope = 'all'; + downloadScope = 'all'; } else { - var downloadScope = 'file'; + downloadScope = 'file'; } if (typeof disableDownloadActions == 'undefined' || !disableDownloadActions) { diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 63fd0f4ce05..84d4f6ed0d1 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1,4 +1,16 @@ -var FileList={ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC, t, n, FileList, FileActions, Files */ +/* global procesSelection, dragOptions, SVGSupport, replaceSVG */ +window.FileList={ useUndo:true, postProcessList: function() { $('#fileList tr').each(function() { @@ -191,6 +203,7 @@ var FileList={ return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/'); }, setCurrentDir: function(targetDir, changeUrl) { + var url; $('#dir').val(targetDir); if (changeUrl !== false) { if (window.history.pushState && changeUrl !== false) { @@ -833,7 +846,7 @@ $(document).ready(function() { {name: 'requesttoken', value: oc_requesttoken} ]; }; - } + } }); file_upload_start.on('fileuploadadd', function(e, data) { diff --git a/apps/files/js/files.js b/apps/files/js/files.js index d794a1584de..441c80762f9 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -1,4 +1,16 @@ -Files={ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC, t, n, FileList, FileActions */ +/* global getURLParameter, isPublic */ +var Files = { // file space size sync _updateStorageStatistics: function() { Files._updateStorageStatisticsTimeout = null; @@ -654,10 +666,10 @@ function procesSelection() { var totalSize = 0; for(var i=0; i 0) { @@ -769,10 +781,11 @@ Files.lazyLoadPreview = function(path, mime, ready, width, height, etag) { } img.src = previewURL; }); -} +}; function getUniqueName(name) { if (FileList.findFileEl(name).exists()) { + var numMatch; var parts=name.split('.'); var extension = ""; if (parts.length > 1) { @@ -806,7 +819,7 @@ function checkTrashStatus() { function onClickBreadcrumb(e) { var $el = $(e.target).closest('.crumb'), - $targetDir = $el.data('dir'); + $targetDir = $el.data('dir'), isPublic = !!$('#isPublic').val(); if ($targetDir !== undefined && !isPublic) { diff --git a/apps/files/js/upgrade.js b/apps/files/js/upgrade.js index 02d57fc9e6c..714adf824a1 100644 --- a/apps/files/js/upgrade.js +++ b/apps/files/js/upgrade.js @@ -1,3 +1,14 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC */ $(document).ready(function () { var eventSource, total, bar = $('#progressbar'); console.log('start'); diff --git a/apps/files/js/upload.js b/apps/files/js/upload.js index 9d9f61f600e..617cf4b1c1d 100644 --- a/apps/files/js/upload.js +++ b/apps/files/js/upload.js @@ -1,3 +1,14 @@ +/* + * Copyright (c) 2014 + * + * This file is licensed under the Affero General Public License version 3 + * or later. + * + * See the COPYING-README file. + * + */ + +/* global OC */ function Upload(fileSelector) { if ($.support.xhrFileUpload) { return new XHRUpload(fileSelector.target.files); diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js index 23f7b58dcd9..2db0bb3bbc0 100644 --- a/apps/files/tests/js/fileactionsSpec.js +++ b/apps/files/tests/js/fileactionsSpec.js @@ -18,7 +18,10 @@ * License along with this library. If not, see . * */ + +/* global OC, FileActions, FileList */ describe('FileActions tests', function() { + var $filesTable; beforeEach(function() { // init horrible parameters var $body = $('body'); diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 61e026c0725..c26e65fc4de 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -18,6 +18,8 @@ * License along with this library. If not, see . * */ + +/* global OC, FileList */ describe('FileList tests', function() { beforeEach(function() { // init horrible parameters diff --git a/apps/files/tests/js/filesSpec.js b/apps/files/tests/js/filesSpec.js index 9d0a2e4f9d7..510b4df0046 100644 --- a/apps/files/tests/js/filesSpec.js +++ b/apps/files/tests/js/filesSpec.js @@ -18,6 +18,8 @@ * License along with this library. If not, see . * */ + +/* global Files */ describe('Files tests', function() { describe('File name validation', function() { it('Validates correct file names', function() { @@ -36,12 +38,14 @@ describe('Files tests', function() { 'und Ümläüte sind auch willkommen' ]; for ( var i = 0; i < fileNames.length; i++ ) { + var error = false; try { expect(Files.isFileNameValid(fileNames[i])).toEqual(true); } catch (e) { - fail(); + error = e; } + expect(error).toEqual(false); } }); it('Detects invalid file names', function() { @@ -69,7 +73,6 @@ describe('Files tests', function() { var threwException = false; try { Files.isFileNameValid(fileNames[i]); - fail(); } catch (e) { threwException = true; -- cgit v1.2.3