]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed upload issue when free space is not known
authorVincent Petry <pvince81@owncloud.com>
Thu, 6 Mar 2014 12:50:53 +0000 (13:50 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 6 Mar 2014 12:53:55 +0000 (13:53 +0100)
apps/files/js/file-upload.js
lib/private/helper.php

index b9c4dc941f7c589b00617270df12496e2ac88062..b7b8f6fdeb6a0897a3435bab371cc373b365c68f 100644 (file)
@@ -206,6 +206,7 @@ OC.Upload = {
                                add: function(e, data) {
                                        OC.Upload.log('add', e, data);
                                        var that = $(this);
+                                       var freeSpace;
 
                                        // we need to collect all data upload objects before starting the upload so we can check their existence
                                        // and set individual conflict actions. unfortunately there is only one variable that we can use to identify
@@ -261,7 +262,8 @@ OC.Upload = {
                                        }
 
                                        // check free space
-                                       if (selection.totalBytes > $('#free_space').val()) {
+                                       freeSpace = $('#free_space').val();
+                                       if (freeSpace >= 0 && selection.totalBytes > freeSpace) {
                                                data.textStatus = 'notenoughspace';
                                                data.errorThrown = t('files', 'Not enough free space, you are uploading {size1} but only {size2} is left', {
                                                        'size1': humanFileSize(selection.totalBytes),
index d8c4650f6660aa1966505430c0f2bd65701d35c9..b9956d5ec1cd4d3f6ba59a09360cc7ae66f1723b 100644 (file)
@@ -839,7 +839,7 @@ class OC_Helper {
         * @return int number of bytes representing
         */
        public static function maxUploadFilesize($dir, $freeSpace = null) {
-               if (is_null($freeSpace)){
+               if (is_null($freeSpace) || $freeSpace < 0){
                        $freeSpace = self::freeSpace($dir);
                }
                return min($freeSpace, self::uploadLimit());