Skip to content

Shared Files filesize subtracted from quota + fix/patch #2796

Description

@tron65

Expected behaviour

User A has quota of 5GB
User B has quota of 5GB

User A owns files of summary size 2GB
User B owns files of summary size 4GB

User B shares 3GB with User A

User A has still 3GB free space

Actual behaviour

User A has no free space left, his 2GB + Shared 3GB fill up his quota

Steps to reproduce

should be obvious from the above

Server configuration

Operating system:
Debian Wheezy

Web server:
apache 2.2.22-13

Database:
mysql 5.5.30+dfsg-1

PHP version:
php5 5.4.4-14

ownCloud version:
5.0.3-0

fix:

for file lib/helper.php

--- helper.php.orig     2013-04-08 20:15:12.071656928 +0200
+++ helper.php  2013-04-08 20:15:51.506027881 +0200
@@ -801,7 +801,8 @@
         */
        public static function getStorageInfo() {
                $rootInfo = \OC\Files\Filesystem::getFileInfo('/');
-               $used = $rootInfo['size'];
+               $sharedInfo = \OC\Files\Filesystem::getFileInfo('/Shared');
+               $used = $rootInfo['size'] - $sharedInfo['size'];
                if ($used < 0) {
                        $used = 0;
                }

for file lib/fileproxy/quota.php


--- quota.php.orig      2013-04-08 20:08:48.663494593 +0200
+++ quota.php   2013-04-08 20:12:26.102512891 +0200
@@ -75,7 +75,13 @@
                $view = new \OC\Files\View("/".$owner."/files");

                $rootInfo = $view->getFileInfo('/');
+               $sharedInfo = $view->getFileInfo('/Shared');
+
                $usedSpace = isset($rootInfo['size'])?$rootInfo['size']:0;
+               $sharedSpace = isset($sharedInfo['size'])?$sharedInfo['size']:0;
+
+               $usedSpace = $usedSpace - $sharedSpace;
+
                return $totalSpace - $usedSpace;
        }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions